GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( b31e19...f7c593 )
by Odiseo
08:36
created

VendorFormMenuBuilder   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 25
c 1
b 0
f 0
dl 0
loc 48
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createMenu() 0 32 3
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Odiseo\SyliusVendorPlugin\Menu;
6
7
use Knp\Menu\FactoryInterface;
8
use Knp\Menu\ItemInterface;
9
use Odiseo\SyliusVendorPlugin\Entity\VendorInterface;
10
use Odiseo\SyliusVendorPlugin\Event\VendorMenuBuilderEvent;
11
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
12
13
final class VendorFormMenuBuilder
14
{
15
    public const EVENT_NAME = 'odiseo_sylius_vendor_plugin.menu.admin.vendor.form';
16
17
    /** @var FactoryInterface */
18
    private $factory;
19
20
    /** @var EventDispatcherInterface */
21
    private $eventDispatcher;
22
23
    public function __construct(FactoryInterface $factory, EventDispatcherInterface $eventDispatcher)
24
    {
25
        $this->factory = $factory;
26
        $this->eventDispatcher = $eventDispatcher;
27
    }
28
29
    public function createMenu(array $options = []): ItemInterface
30
    {
31
        $menu = $this->factory->createItem('root');
32
33
        if (!array_key_exists('vendor', $options) || !$options['vendor'] instanceof VendorInterface) {
34
            return $menu;
35
        }
36
37
        $menu
38
            ->addChild('details')
39
            ->setAttribute('template', '@OdiseoSyliusVendorPlugin/Admin/Vendor/Tab/_details.html.twig')
40
            ->setLabel('sylius.ui.details')
41
            ->setCurrent(true)
42
        ;
43
44
        $menu
45
            ->addChild('profile')
46
            ->setAttribute('template', '@OdiseoSyliusVendorPlugin/Admin/Vendor/Tab/_profile.html.twig')
47
            ->setLabel('odiseo_sylius_vendor_plugin.ui.profile')
48
        ;
49
50
        $menu
51
            ->addChild('media')
52
            ->setAttribute('template', '@OdiseoSyliusVendorPlugin/Admin/Vendor/Tab/_media.html.twig')
53
            ->setLabel('sylius.ui.media')
54
        ;
55
56
        $this->eventDispatcher->dispatch(
57
            new VendorMenuBuilderEvent($this->factory, $menu, $options['vendor'])
58
        );
59
60
        return $menu;
61
    }
62
}
63