AbstractExtensionMenu::get()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 7
nc 4
nop 1
dl 0
loc 13
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Zikula package.
7
 *
8
 * Copyright Zikula - https://ziku.la/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Zikula\ThemeBundle\ExtensionMenu;
15
16
abstract class AbstractExtensionMenu implements ExtensionMenuInterface
17
{
18
    public function get(string $context = ExtensionMenuInterface::CONTEXT_ADMIN): iterable
19
    {
20
        if (ExtensionMenuInterface::CONTEXT_ADMIN === $context) {
21
            return $this->getAdmin();
22
        }
23
        if (ExtensionMenuInterface::CONTEXT_USER === $context) {
24
            return $this->getUser();
25
        }
26
        if (ExtensionMenuInterface::CONTEXT_ACCOUNT === $context) {
27
            return $this->getAccount();
28
        }
29
30
        return [];
31
    }
32
33
    protected function getAdmin(): iterable
34
    {
35
        return [];
36
    }
37
38
    protected function getUser(): iterable
39
    {
40
        return [];
41
    }
42
43
    protected function getAccount(): iterable
44
    {
45
        return [];
46
    }
47
}
48