Esempio n. 1
0
 public function call()
 {
     if (strpos($this->app->request()->getPathInfo(), $this->route) !== false) {
         $this->middleware->setApplication($this->app);
         $this->middleware->setNextMiddleware($this->next);
         $this->middleware->call();
     } else {
         $this->next->call();
     }
 }
Esempio n. 2
0
 /**
  * Add middleware
  *
  * This method prepends new middleware to the application middleware stack.
  * The argument must be an instance that subclasses Slim_Middleware.
  *
  * @param \Slim\Middleware
  */
 public function add(\Slim\Middleware $newMiddleware)
 {
     $newMiddleware->setApplication($this);
     $newMiddleware->setNextMiddleware($this->middleware[0]);
     array_unshift($this->middleware, $newMiddleware);
 }
Esempio n. 3
0
 /**
  * Push middleware
  *
  * This method adds new middleware to the application middleware stack right after the current one
  * This enables us to add it from inside an called middleware
  * The argument must be an instance that subclasses Slim_Middleware.
  *
  * @param \Slim\Middleware
  */
 public function push($first, \Slim\Middleware $newMiddleware)
 {
     $newMiddleware->setApplication($this);
     $newMiddleware->setNextMiddleware($first->getNextMiddleware());
     $first->setNextMiddleware($newMiddleware);
 }