Esempio n. 1
0
 /**
  * Dispatch the request
  *
  * @param Route $route
  *
  * @throws NotFoundHttpException
  * @return mixed
  */
 public function dispatch(Route $route)
 {
     $action = $route->action();
     list($class, $method) = explode('@', $action['uses']);
     if (!method_exists($instance = $this->container->make($class), $method)) {
         throw new NotFoundHttpException();
     }
     $parameters = $this->resolver->resolve(new ReflectionMethod($instance, $method), $route->parameters());
     return $this->container->call([$instance, $method], $parameters);
 }
Esempio n. 2
0
 /**
  * @param Route $route
  *
  * @return bool
  */
 public function isSatisfiedBy(Route $route)
 {
     $action = $route->action();
     return is_callable($action['uses']);
 }
Esempio n. 3
0
 public function test_can_get_parameter()
 {
     $route = new Route(['GET'], '{id}', 'HomeController@index');
     $route->bind(['id' => 1]);
     $this->assertEquals(1, $route->parameter('id'));
 }