Passed
Push — main ( 47a406...6037b2 )
by Thierry
02:35
created

MenuBuilderTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 52
rs 10
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\BreadcrumbComponent;
6
use Lagdo\UiBuilder\Component\BreadcrumbItemComponent;
7
use Lagdo\UiBuilder\Component\MenuComponent;
8
use Lagdo\UiBuilder\Component\MenuItemComponent;
9
10
trait MenuBuilderTrait
11
{
12
    /**
13
     * @return string
14
     */
15
    abstract protected function _menuComponentClass(): string;
16
17
    /**
18
     * @return string
19
     */
20
    abstract protected function _menuItemComponentClass(): string;
21
22
    /**
23
     * @return string
24
     */
25
    abstract protected function _breadcrumbComponentClass(): string;
26
27
    /**
28
     * @return string
29
     */
30
    abstract protected function _breadcrumbItemComponentClass(): string;
31
32
    /**
33
     * @inheritDoc
34
     */
35
    public function menu(...$arguments): MenuComponent
36
    {
37
        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

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