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\AdminBundle\Twig; |
||
4 | |||
5 | use Kunstmaan\AdminBundle\Helper\AdminRouteHelper; |
||
6 | |||
7 | class AdminRouteHelperTwigExtension extends \Twig_Extension |
||
8 | { |
||
9 | /** @var AdminRouteHelper $adminRouteHelper */ |
||
10 | private $adminRouteHelper; |
||
11 | |||
12 | /** |
||
13 | * @param AdminRouteHelper $adminRouteHelper |
||
14 | */ |
||
15 | public function __construct(AdminRouteHelper $adminRouteHelper) |
||
16 | { |
||
17 | $this->adminRouteHelper = $adminRouteHelper; |
||
18 | } |
||
19 | |||
20 | /** |
||
21 | * Returns a list of functions to add to the existing list. |
||
22 | * |
||
23 | * @return array An array of functions |
||
0 ignored issues
–
show
|
|||
24 | */ |
||
25 | public function getFunctions() |
||
26 | { |
||
27 | return array( |
||
28 | new \Twig_SimpleFunction('is_admin_route', array($this, 'isAdminRoute')), |
||
29 | ); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Lets the adminroutehelper determine wether the URI is an admin route |
||
34 | * |
||
35 | * @return bool |
||
36 | */ |
||
37 | public function isAdminRoute($URI) |
||
38 | { |
||
39 | return $this->adminRouteHelper->isAdminRoute($URI); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Get the Twig extension name. |
||
44 | * |
||
45 | * @return string |
||
46 | */ |
||
47 | public function getName() |
||
48 | { |
||
49 | return 'admin_route_helper_twig_extension'; |
||
50 | } |
||
51 | } |
||
52 |
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.