/** * Attempts to find a matching route for input $uri and $method * @param string $uri * @param string $method * @return IRoute */ public function findMatch(\string $uri, \string $method) { foreach ($this->router->getRouteCollection() as $route) { if ($this->isRouteAMatch($route, $uri, $method)) { $route->setUserVariables($this->routeVariablesBuffer); return $route; } } return null; }
/** * @covers Zap\Routing\Router::setRouteCollection */ public function testFetch() { $result = Router::get()->fetch('/some/uri', 'GET'); $this->assertNull($result); // @todo extend test case, once method can return Zap\Http\Response }
/** * Registers route against router * @param Router|null $router * @return IRoute */ public function register(Router $router = null) : IRoute { $router = is_null($router) ? Router::get() : $router; $router->addRoute($this); return $this; }