| Conditions | 9 |
| Paths | 6 |
| Total Lines | 25 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function __construct(array|string $values) |
||
| 26 | { |
||
| 27 | $validValues = [ |
||
| 28 | 'created', |
||
| 29 | 'updated', |
||
| 30 | ]; |
||
| 31 | $valueValueStr = [ |
||
| 32 | 'created,updated', |
||
| 33 | 'created, updated', |
||
| 34 | 'updated,created', |
||
| 35 | 'updated, created', |
||
| 36 | ]; |
||
| 37 | if (!empty($values) && is_string($values) && !in_array($values, $valueValueStr)) { |
||
|
|
|||
| 38 | return; |
||
| 39 | } |
||
| 40 | if (!empty($values) && is_array($values)) { |
||
| 41 | foreach ($values as $value) { |
||
| 42 | if (!in_array($value, $validValues)) { |
||
| 43 | return; |
||
| 44 | } |
||
| 45 | } |
||
| 46 | } |
||
| 47 | $this->events = is_array($values) ? $values : array_map('trim', explode(',', $values)); |
||
| 48 | |||
| 49 | $this->events = array_filter($this->events); |
||
| 50 | } |
||
| 52 |