Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | public function setContainer(ContainerInterface $container = null) |
||
23 | { |
||
24 | parent::setContainer($container); |
||
25 | |||
26 | $requestStack = $container->get('request_stack'); |
||
|
|||
27 | /** @var \Symfony\Component\HttpFoundation\Request $masterRequest */ |
||
28 | $masterRequest = $requestStack->getMasterRequest(); |
||
29 | if ($masterRequest) { |
||
30 | $this->setTarget($masterRequest->getUri()); |
||
31 | } |
||
32 | } |
||
33 | |||
64 |
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: