Issues (1426)

app/src/Service/MenuBuilderSubscriber.php (12 issues)

1
<?php
2
0 ignored issues
show
Missing file doc comment
Loading history...
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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
class MenuBuilderSubscriber implements EventSubscriberInterface
0 ignored issues
show
Missing doc comment for class MenuBuilderSubscriber
Loading history...
10
{
11
    public static function getSubscribedEvents(): array
0 ignored issues
show
Missing doc comment for function getSubscribedEvents()
Loading history...
12
    {
13
        return [
14
            SidebarMenuEvent::class => ['onSetupMenu', 100],
15
        ];
16
    }
17
18
    public function onSetupMenu(SidebarMenuEvent $event)
0 ignored issues
show
Missing doc comment for function onSetupMenu()
Loading history...
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
Missing short description in doc comment
Loading history...
37
     * @param string $route
0 ignored issues
show
Missing parameter comment
Loading history...
Expected 10 spaces after parameter type; 1 found
Loading history...
38
     * @param MenuItemModel[] $items
0 ignored issues
show
Missing parameter comment
Loading history...
39
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
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