/** * Route a controller to a URI with wildcard routing. * * @param string $uri * @param string $controller * @param array $names * * @return void * * @deprecated since version 5.2. */ public function controller($uri, $controller, $names = []) { $prepended = $controller; // First, we will check to see if a controller prefix has been registered in // the route group. If it has, we will need to prefix it before trying to // reflect into the class instance and pull out the method for routing. if (!empty($this->groupStack)) { $prepended = $this->prependGroupUses($controller); } $controllerInspector = new ControllerInspector(); $routable = $controllerInspector->getRoutable($prepended, $uri); // Now we apply our Localization modifications. foreach ($routable as &$routes) { foreach ($routes as &$route) { $route['plain'] = $this->localizeUris($route['plain']); unset($route); } unset($routes); } // When a controller is routed using this method, we use Reflection to parse // out all of the routable methods for the controller, then register each // route explicitly for the developers, so reverse routing is possible. foreach ($routable as $method => $routes) { foreach ($routes as $route) { $this->registerInspected($route, $controller, $method, $names); } } $this->addFallthroughRoute($controller, $uri); }
/** * Determine if the given controller method is routable. * * @param \ReflectionMethod $method * @param string $controller * * @return bool */ public function isRoutable(ReflectionMethod $method, $controller = null) { if ($method->name == 'getProperties') { return false; } return parent::isRoutable($method, $controller); }
/** * Determine if the given controller method is routable. * * @param ReflectionMethod $method * @param string $controller * @return bool */ public function isRoutable(ReflectionMethod $method, $controller) { if ($method->class == 'Dingo\\Api\\Routing\\Controller') { return false; } return parent::isRoutable($method, $controller); }
/** * {@inheritdoc} */ public function isRoutable(ReflectionMethod $method) { if (in_array($method->name, $this->unroutable)) { return false; } return parent::isRoutable($method); }
protected function controller($route_body, &$item = "") { $controllerInspector = new ControllerInspector(); $controller_rules = "/(?<=get|post|any|put|delete)[\\S]*/"; $code = $this->getController($route_body['controller']); $methods = $code->getFunctions(); foreach ($methods as $method) { if (preg_match($controller_rules, $method->name, $match) && $method->isPublic()) { if (strstr("\\" . $method->class, $this->config)) { $route_body_tmp = $route_body; $route_body_tmp['route'] = $controllerInspector->getPlainUri($method->name, $route_body_tmp['route']); $route_body_tmp['method'] = $controllerInspector->getVerb($method->name); $function = $code->getDocument($method, $route_body_tmp['route']); $route_body_tmp = array_merge($route_body_tmp, $function); $item[$route_body_tmp['route']][$route_body_tmp['method']] = $route_body_tmp; } } } }