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