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\Helper\AdminPanel; |
||
4 | |||
5 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; |
||
6 | |||
7 | class DefaultAdminPanelAdaptor implements AdminPanelAdaptorInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var TokenStorageInterface |
||
11 | */ |
||
12 | protected $tokenStorage; |
||
13 | |||
14 | 1 | public function __construct(TokenStorageInterface $tokenStorage) |
|
15 | { |
||
16 | 1 | $this->tokenStorage = $tokenStorage; |
|
17 | 1 | } |
|
18 | |||
19 | /** |
||
20 | * @return AdminPanelActionInterface[] |
||
0 ignored issues
–
show
|
|||
21 | */ |
||
22 | 1 | public function getAdminPanelActions() |
|
23 | { |
||
24 | return [ |
||
25 | 1 | $this->getLanguageChooserAction(), |
|
26 | 1 | $this->getChangePasswordAction(), |
|
27 | 1 | $this->getLogoutAction(), |
|
28 | ]; |
||
29 | } |
||
30 | |||
31 | 1 | protected function getLanguageChooserAction() |
|
32 | { |
||
33 | 1 | return new AdminPanelAction( |
|
34 | 1 | [], |
|
35 | 1 | '', |
|
36 | 1 | '', |
|
37 | 1 | '@KunstmaanAdmin/AdminPanel/_language_chooser.html.twig' |
|
38 | ); |
||
39 | } |
||
40 | |||
41 | 1 | protected function getChangePasswordAction() |
|
42 | { |
||
43 | 1 | $user = $this->tokenStorage->getToken()->getUser(); |
|
44 | |||
45 | 1 | return new AdminPanelAction( |
|
46 | [ |
||
47 | 1 | 'path' => 'KunstmaanUserManagementBundle_settings_users_edit', |
|
48 | 1 | 'params' => ['id' => $user->getId()], |
|
49 | ], |
||
50 | 1 | ucfirst($user->getUsername()), |
|
51 | 1 | 'user' |
|
52 | ); |
||
53 | } |
||
54 | |||
55 | 1 | protected function getLogoutAction() |
|
56 | { |
||
57 | 1 | return new AdminPanelAction( |
|
58 | [ |
||
59 | 1 | 'path' => 'fos_user_security_logout', |
|
60 | 'attrs' => ['id' => 'app__logout', 'title' => 'logout'], |
||
61 | ], |
||
62 | 1 | '', |
|
63 | 1 | 'sign-out' |
|
64 | ); |
||
65 | } |
||
66 | } |
||
67 |
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.