Exemplo n.º 1
0
 /**
  * @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;
 }
Exemplo n.º 2
0
 public function __construct($innerMiddleware)
 {
     $this->innerMiddleware = NimoUtility::wrap($innerMiddleware);
 }
Exemplo n.º 3
0
 /**
  * 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;
 }
Exemplo n.º 4
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testWrap()
 {
     NimoUtility::wrap(null);
 }