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 ( 5b18e5...d5a27a )
by Leonardo
12:09
created

AbstractMenu::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 12
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQLAPI\GraphQLAPI\ConditionalOnEnvironment\Admin\Services\Menus;
6
7
use GraphQLAPI\GraphQLAPI\Admin\MenuPages\AbstractMenuPage;
8
use PoP\ComponentModel\Facades\Instances\InstanceManagerFacade;
9
10
/**
11
 * Admin menu class
12
 */
13
abstract class AbstractMenu
14
{
15
    /**
16
     * @var array<AbstractMenuPage>
17
     */
18
    protected array $menuPageObjects;
19
20
    public function __construct()
21
    {
22
        $instanceManager = InstanceManagerFacade::getInstance();
23
        $this->menuPageObjects = array_map(
24
            function ($menuPageClass) use ($instanceManager): AbstractMenuPage {
25
                /**
26
                 * @var AbstractMenuPage
27
                 */
28
                $menuPageObject = $instanceManager->getInstance($menuPageClass);
29
                return $menuPageObject;
30
            },
31
            $this->getMenuPageClasses()
32
        );
33
    }
34
35
    abstract public static function getName(): string;
36
37
    /**
38
     * @return string[]
39
     */
40
    protected function getMenuPageClasses(): array
41
    {
42
        return [];
43
    }
44
45
    /**
46
     * Initialize the endpoints
47
     *
48
     * @return void
49
     */
50
    public function initialize(): void
51
    {
52
        /**
53
         * Low priority to execute before adding the menus for the CPTs
54
         */
55
        \add_action(
56
            'admin_menu',
57
            [$this, 'addMenuPagesTop'],
58
            9
59
        );
60
        /**
61
         * High priority to execute after adding the menus for the CPTs
62
         */
63
        \add_action(
64
            'admin_menu',
65
            [$this, 'addMenuPagesBottom'],
66
            20
67
        );
68
69
        /**
70
         * Initialize my menu pages
71
         *
72
         * @return void
73
         */
74
        foreach ($this->menuPageObjects as $menuPageObject) {
75
            $menuPageObject->initialize();
76
        }
77
    }
78
    public function addMenuPagesTop(): void
79
    {
80
        // Initially empty
81
    }
82
83
    public function addMenuPagesBottom(): void
84
    {
85
        // Initially empty
86
    }
87
}
88