Skip to content

Commit

Permalink
getRouter should always return Router instance
Browse files Browse the repository at this point in the history
  • Loading branch information
ahoulgrave committed Feb 10, 2018
1 parent d0dfa25 commit d93abfe
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Bear/Routing/SymfonyRoutingAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,20 @@ public function resolve(string $uri, string $method): RoutingResolution
*/
public function init(): void
{
$context = new RequestContext();
$context->fromRequest($this->request);
$this->router = new Router($this->loader, $this->resource, [], $context);
}

/**
* @return Router
*/
public function getRouter(): Router
{
if (!$this->router) {
$context = new RequestContext();
$context->fromRequest($this->request);

$this->router = new Router($this->loader, $this->resource, [], $context);
}

return $this->router;
}
}

0 comments on commit d93abfe

Please sign in to comment.