/** Calls a routine on the current route and returns its result */ public function routineCall($type, $method, AbstractRoutine $routine, &$routeParamsValues) { $reflection = $this->route->getReflection($method); $callbackParameters = array(); if ($routine instanceof ParamSynced) { foreach ($routine->getParameters() as $parameter) { $callbackParameters[] = $this->extractRouteParam($reflection, $parameter, $routeParamsValues); } } else { $callbackParameters = $routeParamsValues; } return $routine->{$type}($this, $callbackParameters); }
public function appendRoute(AbstractRoute $route) { $this->routes[] = $route; foreach ($this->globalRoutines as $routine) { $route->appendRoutine($routine); } usort($this->routes, function ($a, $b) { $a = $a->getPath(); $b = $b->getPath(); if (0 === stripos($a, $b)) { return 1; } elseif (0 === stripos($b, $a)) { return -1; } elseif (substr_count($a, '/') < substr_count($b, '/')) { return 1; } return substr_count($a, AbstractRoute::PARAM_IDENTIFIER) < substr_count($b, AbstractRoute::PARAM_IDENTIFIER) ? -1 : 1; }); }
public function __construct($class, $callback) { $this->class = $class; $this->callback = $callback; parent::__construct('ANY', '^$'); }
/** Returns true if the passed route matches the passed request */ protected function matchRoute(Request $request, AbstractRoute $route, &$params = array()) { $request->route = $route; return $route->match($request, $params); }
public function __construct($method, $pattern, $instance) { $this->instance = $instance; $this->class = get_class($instance); parent::__construct($method, $pattern); }
public function __construct($method, $pattern, $class, $factory) { $this->factory = $factory; $this->class = $class; parent::__construct($method, $pattern); }
/** * @param string $method The HTTP method (GET, POST, etc) * @param string $pattern The URI pattern for this route (like /users/*) * @param string $class The class name * @param array $params Constructor params for the class * * @see Respect\Rest\Routes\ClassName::$class * @see Respect\Rest\Routes\ClassName::$constructorParams */ public function __construct($method, $pattern, $class, array $params = array()) { $this->class = $class; $this->constructorParams = $params; parent::__construct($method, $pattern); }
public function __construct($method, $pattern, $callback) { $this->callback = $callback; parent::__construct($method, $pattern); }
public function __construct($method, $pattern, $value) { $this->value = $value; parent::__construct($method, $pattern); $this->reflection = new ReflectionMethod($this, 'returnValue'); }
/** * @param string $method The HTTP method (GET, POST, etc) * @param string $pattern The URI pattern for this route * @param callable $callback The callback this route holds * @param array $arguments Additional arguments for this callback */ public function __construct($method, $pattern, $callback, array $arguments = array()) { $this->callback = $callback; $this->arguments = $arguments; parent::__construct($method, $pattern); }
public function __construct($method, $pattern, $instance) { $this->instance = $instance; parent::__construct($method, $pattern); }