These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\MultiDomainBundle\Twig; |
||
4 | |||
5 | use Kunstmaan\AdminBundle\Helper\DomainConfigurationInterface; |
||
6 | |||
7 | class MultiDomainTwigExtension extends \Twig_Extension |
||
8 | { |
||
9 | /** |
||
10 | * @var DomainConfigurationInterface |
||
11 | */ |
||
12 | private $domainConfiguration; |
||
13 | |||
14 | public function __construct(DomainConfigurationInterface $domainConfiguration) |
||
15 | { |
||
16 | $this->domainConfiguration = $domainConfiguration; |
||
17 | } |
||
18 | |||
19 | /** |
||
20 | * Get Twig functions defined in this extension. |
||
21 | * |
||
22 | * @return array |
||
0 ignored issues
–
show
|
|||
23 | */ |
||
24 | public function getFunctions() |
||
25 | { |
||
26 | return array( |
||
27 | new \Twig_SimpleFunction('get_multi_domain_hosts', array($this, 'getMultiDomainHosts')), |
||
28 | new \Twig_SimpleFunction('get_current_host', array($this, 'getCurrentHost')), |
||
29 | new \Twig_SimpleFunction('get_extra_data', array($this, 'getExtraData')), |
||
30 | new \Twig_SimpleFunction('get_current_full_host', array($this, 'getCurrentFullHost')), |
||
0 ignored issues
–
show
The class
Twig_SimpleFunction has been deprecated with message: since Twig 2.7, use "Twig\TwigFunction" instead
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
31 | ); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @param $key |
||
36 | */ |
||
37 | public function getExtraData($key) |
||
38 | { |
||
39 | $extraData = $this->domainConfiguration->getExtraData(); |
||
40 | |||
41 | if ($extraData[$key]) { |
||
42 | return $extraData[$key]; |
||
43 | } |
||
44 | |||
45 | return null; |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @return array |
||
50 | */ |
||
51 | public function getMultiDomainHosts() |
||
52 | { |
||
53 | return $this->domainConfiguration->getHosts(); |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * @return string |
||
58 | */ |
||
59 | public function getCurrentHost() |
||
60 | { |
||
61 | return $this->domainConfiguration->getHost(); |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * @return array |
||
66 | */ |
||
67 | public function getCurrentFullHost() |
||
68 | { |
||
69 | return $this->domainConfiguration->getFullHost(); |
||
70 | } |
||
71 | } |
||
72 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.