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

DropdownBuilderTrait::dropdownMenuItem()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Lagdo\UiBuilder\Builder;
4
5
use Lagdo\UiBuilder\Component\DropdownComponent;
6
use Lagdo\UiBuilder\Component\DropdownItemComponent;
7
use Lagdo\UiBuilder\Component\DropdownMenuComponent;
8
use Lagdo\UiBuilder\Component\DropdownMenuItemComponent;
9
10
trait DropdownBuilderTrait
11
{
12
    /**
13
     * @return string
14
     */
15
    abstract protected function _dropdownComponentClass(): string;
16
17
    /**
18
     * @return string
19
     */
20
    abstract protected function _dropdownItemComponentClass(): string;
21
22
    /**
23
     * @return string
24
     */
25
    abstract protected function _dropdownMenuComponentClass(): string;
26
27
    /**
28
     * @return string
29
     */
30
    abstract protected function _dropdownMenuItemComponentClass(): string;
31
32
    /**
33
     * @inheritDoc
34
     */
35
    public function dropdown(...$arguments): DropdownComponent
36
    {
37
        return $this->createComponentOfClass($this->_dropdownComponentClass(), $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->_dropdownComponentClass(), $arguments);
Loading history...
38
    }
39
40
    /**
41
     * @inheritDoc
42
     */
43
    public function dropdownItem(...$arguments): DropdownItemComponent
44
    {
45
        return $this->createComponentOfClass($this->_dropdownItemComponentClass(), $arguments);
46
    }
47
48
    /**
49
     * @inheritDoc
50
     */
51
    public function dropdownMenu(...$arguments): DropdownMenuComponent
52
    {
53
        return $this->createComponentOfClass($this->_dropdownMenuComponentClass(), $arguments);
54
    }
55
56
    /**
57
     * @inheritDoc
58
     */
59
    public function dropdownMenuItem(...$arguments): DropdownMenuItemComponent
60
    {
61
        return $this->createComponentOfClass($this->_dropdownMenuItemComponentClass(), $arguments);
62
    }
63
}
64