Total Complexity | 11 |
Total Lines | 79 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | trait ItemStyleTrait |
||
6 | { |
||
7 | protected $markerOn = ''; |
||
8 | |||
9 | protected $markerOff = ''; |
||
10 | |||
11 | protected $itemExtra = ''; |
||
12 | |||
13 | protected $displaysExtra = false; |
||
14 | |||
15 | protected $custom = false; |
||
16 | |||
17 | public function getIsCustom() : bool |
||
18 | { |
||
19 | return $this->custom; |
||
20 | } |
||
21 | |||
22 | public function getMarker(bool $selected) : string |
||
23 | { |
||
24 | return $selected ? $this->markerOn : $this->markerOff; |
||
25 | } |
||
26 | |||
27 | public function getMarkerOn() : string |
||
28 | { |
||
29 | return $this->markerOn; |
||
30 | } |
||
31 | |||
32 | public function setMarkerOn(string $marker) : self |
||
33 | { |
||
34 | $this->custom = true; |
||
35 | |||
36 | $this->markerOn = $marker; |
||
37 | |||
38 | return $this; |
||
39 | } |
||
40 | |||
41 | public function getMarkerOff() : string |
||
42 | { |
||
43 | return $this->markerOff; |
||
44 | } |
||
45 | |||
46 | public function setMarkerOff(string $marker) : self |
||
47 | { |
||
48 | $this->custom = true; |
||
49 | |||
50 | $this->markerOff = $marker; |
||
51 | |||
52 | return $this; |
||
53 | } |
||
54 | |||
55 | public function getItemExtra() : string |
||
56 | { |
||
57 | return $this->itemExtra; |
||
58 | } |
||
59 | |||
60 | public function setItemExtra(string $itemExtra) : self |
||
61 | { |
||
62 | $this->custom = true; |
||
63 | |||
64 | $this->itemExtra = $itemExtra; |
||
65 | |||
66 | // if we customise item extra, it means we most likely want to display it |
||
67 | $this->setDisplaysExtra(true); |
||
68 | |||
69 | return $this; |
||
70 | } |
||
71 | |||
72 | public function getDisplaysExtra() : bool |
||
75 | } |
||
76 | |||
77 | public function setDisplaysExtra(bool $displaysExtra) : self |
||
84 | } |
||
85 | } |
||
86 |