| Total Complexity | 5 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | trait OptionsTrait |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var ArrayCollection |
||
| 14 | */ |
||
| 15 | private $options; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Must be called for using this trait. |
||
| 19 | * |
||
| 20 | * @param array $options |
||
| 21 | */ |
||
| 22 | 118 | public function initOptions(array $options): void |
|
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @param string $option |
||
| 29 | * @param mixed $value |
||
| 30 | * |
||
| 31 | * @return $this |
||
| 32 | */ |
||
| 33 | 7 | public function setOption(string $option, $value): self |
|
| 34 | { |
||
| 35 | 7 | $this->options->offsetSet($option, $value); |
|
| 36 | |||
| 37 | 7 | return $this; |
|
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @param string $option |
||
| 42 | * @param mixed|null $defaultValue |
||
| 43 | * |
||
| 44 | * @return mixed|null |
||
| 45 | */ |
||
| 46 | 92 | public function getOption(string $option, $defaultValue = null) |
|
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @param string $option |
||
| 57 | * |
||
| 58 | * @return bool |
||
| 59 | */ |
||
| 60 | 2 | public function hasOption(string $option): bool |
|
| 63 | } |
||
| 64 | } |
||
| 65 |