| Conditions | 6 |
| Paths | 7 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 36 | 36 | protected function setDefault(mixed $value = null): static |
|
| 37 | { |
||
| 38 | 36 | if (is_array($value)) { |
|
| 39 | 7 | if (in_array($this->getAttribute('value')?->getValueString(), $value)) { |
|
| 40 | 7 | $this->setAttribute(AttributeFactory::create('selected')); |
|
| 41 | 7 | return $this; |
|
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 45 | 36 | if (is_string($value) || is_numeric($value)) { |
|
| 46 | 29 | if ($this->getAttribute('value')?->getValueString() == $value) { |
|
| 47 | 6 | $this->setAttribute(AttributeFactory::create('selected')); |
|
| 48 | 6 | return $this; |
|
| 49 | } |
||
| 50 | } |
||
| 51 | 36 | return $this; |
|
| 52 | } |
||
| 63 |