bytic /
router
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Nip\Router; |
||
| 4 | |||
| 5 | use Nip\Request; |
||
| 6 | use Nip\Router\Generator\CompiledUrlGenerator; |
||
| 7 | use Nip\Router\Generator\UrlGenerator; |
||
| 8 | use Nip\Router\Legacy\Router\Traits\HasMatcherTrait as LegacyHasMatcherTrait; |
||
| 9 | use Nip\Router\Router\Traits\HasCurrentRouteTrait; |
||
| 10 | use Nip\Router\Router\Traits\HasGeneratorTrait; |
||
| 11 | use Nip\Router\Router\Traits\HasMatcherTrait; |
||
| 12 | use Nip\Router\Router\Traits\HasRouteCollectionTrait; |
||
| 13 | use Psr\Log\LoggerInterface; |
||
| 14 | use Symfony\Component\Config\Loader\LoaderInterface; |
||
| 15 | use Symfony\Component\Routing\Loader\ClosureLoader; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Class Router |
||
| 19 | * @package Nip\Router |
||
| 20 | * |
||
| 21 | * @method CompiledUrlGenerator getGenerator() |
||
| 22 | */ |
||
| 23 | class Router extends \Symfony\Component\Routing\Router |
||
| 24 | { |
||
| 25 | use LegacyHasMatcherTrait; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 26 | |||
| 27 | use HasRouteCollectionTrait; |
||
| 28 | use HasCurrentRouteTrait; |
||
| 29 | use HasGeneratorTrait; |
||
| 30 | use HasMatcherTrait; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @inheritdoc |
||
| 34 | */ |
||
| 35 | 8 | public function __construct( |
|
| 36 | LoaderInterface $loader = null, |
||
| 37 | $resource = null, |
||
| 38 | array $options = [], |
||
| 39 | RequestContext $context = null, |
||
| 40 | LoggerInterface $logger = null |
||
| 41 | ) { |
||
| 42 | 8 | $loader = $loader ?: new ClosureLoader(); |
|
| 43 | 8 | $options['generator_class'] = isset($options['generator_class']) ? $options['generator_class'] : CompiledUrlGenerator::class; |
|
| 44 | // $options['generator_base_class'] = isset($options['generator_base_class']) ? $options['generator_base_class'] : UrlGenerator::class; |
||
| 45 | 8 | $context = $context ?: new RequestContext(); |
|
| 46 | 8 | return parent::__construct($loader, $resource, $options, $context, $logger); |
|
|
0 ignored issues
–
show
Are you sure the usage of
parent::__construct($loa...ons, $context, $logger) targeting Symfony\Component\Routing\Router::__construct() seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @var \Nip\Request |
||
| 51 | */ |
||
| 52 | protected $request; |
||
| 53 | |||
| 54 | |||
| 55 | /** |
||
| 56 | * @return Request |
||
| 57 | */ |
||
| 58 | public function getRequest() |
||
| 59 | { |
||
| 60 | return $this->request; |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @param mixed $request |
||
| 65 | */ |
||
| 66 | public function setRequest($request) |
||
| 67 | { |
||
| 68 | $this->request = $request; |
||
| 69 | } |
||
| 70 | } |
||
| 71 |