public function __construct(\Micro\ControllerInterface $handler)
 {
     $this->handler = $handler;
     $msg = sprintf("Handler for URI '%s' produced an invalid return, should be a Response", $handler->uri());
     parent::__construct($msg);
 }
Example #2
0
 public function match(\Micro\Request $request, \Micro\ControllerInterface $controller)
 {
     return in_array($request->getMethod(), $controller->methods());
 }
Example #3
0
 /**
  * Gathers custom parameters from a URL based on the conditions given by
  * the Controller.
  * 
  * @param \Micro\ControllerInterface $controller
  * @param \Micro\Request $request
  * @return void
  */
 protected function addParameters(ControllerInterface $controller, Request $request)
 {
     $regex = $this->ut->compile($controller->uri(), $controller->conditions());
     $params = $this->ut->parameters($regex, $request->getPathInfo());
     $request->request->add($params);
 }
Example #4
0
 public function match(\Micro\Request $request, \Micro\ControllerInterface $controller)
 {
     $ut = $this->ut;
     $regex = $ut->compile($controller->uri(), $controller->conditions());
     return $ut->match($regex, $request->getPathInfo());
 }
Example #5
0
 public function match(\Micro\Request $request, \Micro\ControllerInterface $controller)
 {
     return $controller->accepts($request);
 }