1 | <?php |
||
8 | class CanonicalUrlGenerator |
||
9 | { |
||
10 | /** @var RouterInterface */ |
||
11 | protected $router; |
||
12 | /** @var string */ |
||
13 | protected $siteUrl; |
||
14 | /** @var bool */ |
||
15 | protected $trailingSlash; |
||
16 | |||
17 | /** |
||
18 | * CanonicalUrlService constructor. |
||
19 | * @param RouterInterface $router |
||
20 | * @param array $config |
||
21 | */ |
||
22 | 5 | public function __construct(RouterInterface $router, array $config = []) |
|
29 | |||
30 | /** |
||
31 | * Returns the canonical URL for a route. |
||
32 | * |
||
33 | * @param string $route |
||
34 | * @param array|string $parameters |
||
35 | * |
||
36 | * @return string |
||
37 | */ |
||
38 | 3 | public function generateUrl($route, $parameters = []) |
|
56 | |||
57 | /** |
||
58 | * @param array $parameters |
||
59 | * @return array|string |
||
60 | */ |
||
61 | 3 | protected function getParameters($parameters = []) |
|
73 | } |
||
74 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.