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.

ConfigProvider::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Core23\MenuBundle\Provider;
13
14
use Core23\MenuBundle\Menu\ConfigBuilderInterface;
15
use InvalidArgumentException;
16
use Knp\Menu\ItemInterface;
17
use Knp\Menu\Provider\MenuProviderInterface;
18
19
final class ConfigProvider implements MenuProviderInterface
20
{
21
    /**
22
     * @var ConfigBuilderInterface
23
     */
24
    private $builder;
25
26
    /**
27
     * @var array<string, mixed>
28
     */
29
    private $menus;
30
31
    public function __construct(ConfigBuilderInterface $builder, array $menuIds)
32
    {
33
        $this->builder = $builder;
34
        $this->menus   = $menuIds;
35
    }
36
37
    public function get($name, array $options = []): ItemInterface
38
    {
39
        if (!$this->has($name)) {
40
            throw new InvalidArgumentException(sprintf('The menu "%s" is not defined.', $name));
41
        }
42
43
        return $this->builder->buildMenu($this->menus[$name], $options);
44
    }
45
46
    public function has($name, array $options = []): bool
47
    {
48
        return isset($this->menus[$name]);
49
    }
50
}
51