return $this->defaultRequest($request);
}
- $response = $this->{$action}();
+ $response = $this->{$action}($request);
$this->afterRequest($response);
require_once HOPLITE_ROOT . '/http2/response.php';
abstract class Middleware {
- protected $pipeline;
protected $next;
- public function __construct(Pipeline $pipeline,
- Middleware $next) {
- $this->pipeline = $pipeline;
+ public function __construct(Middleware $next) {
$this->next = $next;
}
class ClosureMiddleware extends Middleware {
private $closure;
- public function __construct(Pipeline $pipeline,
- Middleware $next,
+ public function __construct(Middleware $next,
\Closure $closure) {
- parent::__construct($pipeline, $next);
+ parent::__construct($next);
$this->closure = $closure;
}
public function buildMiddleware($args, $next) {
if ($args instanceof \Closure) {
- return new ClosureMiddleware($this, $next, $args);
+ return new ClosureMiddleware($next, $args);
} else if ($args instanceof Pipeline) {
return $args->_build($next);
} else if (is_array($args)) {
$class = array_shift($args);
- array_unshift($args, $this, $next);
+ array_unshift($args, $next);
return new $class(...$args);
} else {
- return new $args($this, $next);
+ return new $args($next);
}
}
private $map;
private $subpipe;
- public function __construct(Pipeline $pipeline,
- Middleware $next,
+ public function __construct(Middleware $next,
RouteMap $map,
Pipeline $subpipe=NULL) {
- parent::__construct($pipeline, $next);
+ parent::__construct($next);
$this->map = $map;
$this->subpipe = $subpipe ? $subpipe : new Pipeline();
}