/** * Method injection resolver * * @param $action * @param $params * @return mixed */ protected function resolve($action, $params) { if ($action instanceof Closure) { return $action($params); } list($controller, $method) = $action; $reflect = new ReflectionClass($controller); foreach (array_filter($reflect->getMethod($method)->getParameters(), $this->getParams()) as $param) { array_unshift($params, $this->registry->make($param->getClass()->getName())); } return $reflect->getMethod($method)->invokeArgs($this->registry->make($controller), $params); }
/** * @return Collection */ protected function loadRoutes() { $router = $this->container->make('routes'); $routes = realpath($this->getPath() . '/app/routes.php'); if (file_exists($routes)) { require $routes; } return $router; }