/** * @param string $path the path * @param mixed $middleware corresponding middleware to execute * @return $this */ public function addPath($path, $middleware) { $path = ltrim($path, '/'); if (isset($this->paths[$path])) { throw new \InvalidArgumentException('path already exist'); } $this->paths[$path] = NimoUtility::wrap($middleware); return $this; }
public function __construct($innerMiddleware) { $this->innerMiddleware = NimoUtility::wrap($innerMiddleware); }
/** * prepend $middleware * return $this * note this method would modify $this * * @param $middleware * @return $this */ public function prepend($middleware) { array_unshift($this->stack, NimoUtility::wrap($middleware)); return $this; }
/** * @expectedException \InvalidArgumentException */ public function testWrap() { NimoUtility::wrap(null); }