@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
at recaptime-dev/main 29 lines 584 B view raw
1<?php 2 3namespace PhpMimeMailParser; 4 5/** 6 * Wraps a callable as a Middleware 7 */ 8class Middleware implements Contracts\Middleware 9{ 10 protected $parser; 11 12 /** 13 * Create a middleware using a callable $fn 14 * 15 * @param callable $fn 16 */ 17 public function __construct(callable $fn) 18 { 19 $this->parser = $fn; 20 } 21 22 /** 23 * Process a mime part, optionally delegating parsing to the $next MiddlewareStack 24 */ 25 public function parse(MimePart $part, MiddlewareStack $next) 26 { 27 return call_user_func($this->parser, $part, $next); 28 } 29}