/** * @param BaseRouter|Router $router * @param BaseContext|Context $context * @param BaseRoute|Route $route * @return bool */ public function pass(BaseRouter $router, BaseContext $context, BaseRoute $route) : bool { $values = $router->extract($context, $route); if ($this->doBind) { $values = $router->bind($values, $route->getBindings()); } $arguments = $router->buildArguments($this->callback, $values, $this->doBind); $callback = $this->callback; return $callback(...$arguments); }
/** * @param Context $context * @param Route $route * @param Router $router * @return bool */ public function pass(Router $router, Context $context, Route $route) : bool { $filter = $route->get('filter'); if (!is_callable($filter)) { return true; } $values = $router->extract($context, $route); $bindings = $router->bind($values, $route->getBindings()); $arguments = $router->buildArguments($filter, $bindings); return $filter(...$arguments); }