MenuBuilderTrait   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A menu() 0 3 1
A breadcrumb() 0 3 1
A breadcrumbItem() 0 3 1
A menuItem() 0 3 1
1
<?php
2
3
namespace Lagdo\UiBuilder\Builder;
4
5
use Lagdo\UiBuilder\Component\Base;
6
use Lagdo\UiBuilder\Component\Base\MenuItemComponent;
7
8
trait MenuBuilderTrait
9
{
10
    /**
11
     * @var string
12
     */
13
    protected string $menuComponentClass = '';
14
15
    /**
16
     * @var string
17
     */
18
    protected string $menuItemComponentClass = '';
19
20
    /**
21
     * @var string
22
     */
23
    protected string $breadcrumbComponentClass = '';
24
25
    /**
26
     * @var string
27
     */
28
    protected string $breadcrumbItemComponentClass = '';
29
30
    /**
31
     * @inheritDoc
32
     */
33
    public function menu(...$arguments): Base\MenuComponent
34
    {
35
        return $this->createComponentOfClass($this->menuComponentClass, $arguments);
0 ignored issues
show
Bug introduced by
It seems like createComponentOfClass() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

35
        return $this->/** @scrutinizer ignore-call */ createComponentOfClass($this->menuComponentClass, $arguments);
Loading history...
36
    }
37
38
    /**
39
     * @inheritDoc
40
     */
41
    public function menuItem(...$arguments): Base\MenuItemComponent
42
    {
43
        return $this->createComponentOfClass($this->menuItemComponentClass, $arguments);
44
    }
45
46
    /**
47
     * @inheritDoc
48
     */
49
    public function breadcrumb(...$arguments): Base\BreadcrumbComponent
50
    {
51
        return $this->createComponentOfClass($this->breadcrumbComponentClass, $arguments);
52
    }
53
54
    /**
55
     * @inheritDoc
56
     */
57
    public function breadcrumbItem(...$arguments): Base\BreadcrumbItemComponent
58
    {
59
        return $this->createComponentOfClass($this->breadcrumbItemComponentClass, $arguments);
60
    }
61
}
62