1 | <?php |
||
8 | class CanonicalLinkExtension extends \Twig_Extension |
||
9 | { |
||
10 | /** @var CanonicalUrlGenerator */ |
||
11 | protected $canonicalUrlGenerator; |
||
12 | /** @var RequestStack */ |
||
13 | protected $requestStack; |
||
14 | |||
15 | /** |
||
16 | * CanonicalLinkExtension constructor. |
||
17 | * @param CanonicalUrlGenerator $canonicalUrlGenerator |
||
18 | * @param RequestStack $requestStack |
||
19 | */ |
||
20 | 2 | public function __construct(CanonicalUrlGenerator $canonicalUrlGenerator, RequestStack $requestStack) |
|
25 | |||
26 | /** |
||
27 | * @return array |
||
28 | */ |
||
29 | 1 | public function getFunctions() |
|
39 | |||
40 | /** |
||
41 | * @param \Twig_Environment $environment |
||
42 | * @param string $href |
||
43 | * |
||
44 | * @return string |
||
45 | */ |
||
46 | 1 | public function renderLinkTag(\Twig_Environment $environment, $href = null) |
|
54 | |||
55 | /** |
||
56 | * @param string $route |
||
57 | * @param string|array $parameters |
||
58 | * |
||
59 | * @return string |
||
60 | */ |
||
61 | 1 | public function generateUrl($route = null, $parameters = null) |
|
71 | } |
||
72 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: