1 | <?php |
||
2 | |||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
3 | namespace Db3v4l\Service; |
||
4 | |||
5 | use KevinPapst\AdminLTEBundle\Event\SidebarMenuEvent; |
||
0 ignored issues
–
show
The type
KevinPapst\AdminLTEBundle\Event\SidebarMenuEvent was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
6 | use KevinPapst\AdminLTEBundle\Model\MenuItemModel; |
||
0 ignored issues
–
show
The type
KevinPapst\AdminLTEBundle\Model\MenuItemModel was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
7 | use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
||
0 ignored issues
–
show
The type
Symfony\Component\EventD...ventSubscriberInterface was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
8 | |||
9 | class MenuBuilderSubscriber implements EventSubscriberInterface |
||
0 ignored issues
–
show
|
|||
10 | { |
||
11 | public static function getSubscribedEvents(): array |
||
0 ignored issues
–
show
|
|||
12 | { |
||
13 | return [ |
||
14 | SidebarMenuEvent::class => ['onSetupMenu', 100], |
||
15 | ]; |
||
16 | } |
||
17 | |||
18 | public function onSetupMenu(SidebarMenuEvent $event) |
||
0 ignored issues
–
show
|
|||
19 | { |
||
20 | $instances = new MenuItemModel('instances', 'DB Instances', 'instance_list', [], 'fas fa-server'); |
||
21 | $adminer = new MenuItemModel('adminer', 'Adminer', '/admin/', [], 'fas fa-toolbox'); |
||
22 | $docs = new MenuItemModel('docs', 'Docs', 'doc_list', [], 'fas fa-book'); |
||
23 | $sources = new MenuItemModel('sources', 'Source code', 'https://github.com/gggeek/db-3v4l', [], 'fab fa-github'); |
||
24 | |||
25 | $event->addItem($instances); |
||
26 | $event->addItem($adminer); |
||
27 | $event->addItem($docs); |
||
28 | $event->addItem($sources); |
||
29 | |||
30 | $this->activateByRoute( |
||
31 | $event->getRequest()->get('_route'), |
||
32 | $event->getItems() |
||
33 | ); |
||
34 | } |
||
35 | |||
36 | /** |
||
0 ignored issues
–
show
|
|||
37 | * @param string $route |
||
0 ignored issues
–
show
|
|||
38 | * @param MenuItemModel[] $items |
||
0 ignored issues
–
show
|
|||
39 | */ |
||
0 ignored issues
–
show
|
|||
40 | protected function activateByRoute($route, $items) |
||
41 | { |
||
42 | foreach ($items as $item) { |
||
43 | if ($item->hasChildren()) { |
||
44 | $this->activateByRoute($route, $item->getChildren()); |
||
45 | } elseif ($item->getRoute() == $route) { |
||
46 | $item->setIsActive(true); |
||
47 | } |
||
48 | } |
||
49 | } |
||
50 | } |
||
51 |