middleware = $middleware; $this->handler = $default; $this->container = $container; } /** * Add callable initializing Middleware that will be executed as soon as possible. * * @param string $name * @param callable $callable * @return $this */ public function addCallable(string $name, callable $callable): self { $this->container[$name] = $callable; array_unshift($this->middleware, $name); return $this; } /** * Add Middleware that will be executed as soon as possible. * * @param string $name * @param MiddlewareInterface $middleware * @return $this */ public function addMiddleware(string $name, MiddlewareInterface $middleware): self { $this->container[$name] = $middleware; array_unshift($this->middleware, $name); return $this; } }