FlexPage   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 22
dl 0
loc 53
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getContext() 0 3 1
A setContext() 0 3 1
A __construct() 0 34 1
1
<?php
2
3
namespace Leonidas\Library\Admin\Component\Page;
4
5
use Leonidas\Contracts\Admin\Component\Page\AdminPageLayoutInterface;
6
use Leonidas\Contracts\Admin\Component\Page\AdminTitleResolverInterface;
7
use Leonidas\Contracts\Admin\Component\Page\FlexPageInterface;
8
use Leonidas\Contracts\Admin\Component\Page\LoadErrorPageInterface;
9
use Leonidas\Contracts\Admin\Component\Page\ParentFileResolverInterface;
10
use Leonidas\Contracts\Admin\Component\Page\SubmenuFileResolverInterface;
11
use Leonidas\Enum\Admin\Page\AdminPageContext;
12
use Leonidas\Library\Admin\Component\Page\Abstracts\NestedPageTrait;
13
14
class FlexPage extends MenuPage implements FlexPageInterface
15
{
16
    use NestedPageTrait {
17
        __construct as __nestedPageConstruct;
18
    }
19
20
    protected AdminPageContext $context;
21
22
    public function __construct(
23
        AdminPageContext $context,
24
        string $pageTitle,
25
        string $menuTitle,
26
        string $menuSlug,
27
        int $position,
28
        AdminPageLayoutInterface $layout,
29
        LoadErrorPageInterface $loadErrorPage,
30
        ?string $iconUrl,
31
        ?string $capability = null,
32
        ?string $titleInSubmenu,
33
        ?AdminTitleResolverInterface $adminTitleResolver = null,
34
        ?ParentFileResolverInterface $parentFileResolver = null,
35
        ?SubmenuFileResolverInterface $subMenuFileResolver = null
36
    ) {
37
        $this->context = $context;
38
39
        $this->__nestedPageConstruct(
40
            $pageTitle,
41
            $parentFileResolver,
42
            $subMenuFileResolver
43
        );
44
45
        parent::__construct(
46
            $pageTitle,
47
            $menuTitle,
0 ignored issues
show
Bug introduced by
$menuTitle of type string is incompatible with the type Leonidas\Contracts\Admin...eResolverInterface|null expected by parameter $parentFileResolver of Leonidas\Library\Admin\C...ageTrait::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

47
            /** @scrutinizer ignore-type */ $menuTitle,
Loading history...
48
            $menuSlug,
0 ignored issues
show
Bug introduced by
$menuSlug of type string is incompatible with the type Leonidas\Contracts\Admin...eResolverInterface|null expected by parameter $subMenuFileResolver of Leonidas\Library\Admin\C...ageTrait::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

48
            /** @scrutinizer ignore-type */ $menuSlug,
Loading history...
49
            $position,
0 ignored issues
show
Unused Code introduced by
The call to Leonidas\Library\Admin\C...ageTrait::__construct() has too many arguments starting with $position. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

49
        parent::/** @scrutinizer ignore-call */ 
50
                __construct(

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
50
            $layout,
51
            $loadErrorPage,
52
            $iconUrl,
53
            $capability,
54
            $titleInSubmenu,
55
            $adminTitleResolver
56
        );
57
    }
58
59
    public function getContext(): AdminPageContext
60
    {
61
        return $this->context;
62
    }
63
64
    public function setContext(AdminPageContext $context)
65
    {
66
        $this->context = $context;
67
    }
68
}
69