| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | 92 | public function decode(string|int $value): mixed |
|
| 31 | { |
||
| 32 | 92 | if (is_int($value)) { |
|
| 33 | 46 | return $value; |
|
| 34 | } |
||
| 35 | |||
| 36 | 92 | $decoded = $this->config->decoder->decode($value); |
|
| 37 | |||
| 38 | 92 | if (!$decoded->succeeded) { |
|
| 39 | 6 | call_user_func($this->config->onDecodingError, $decoded); |
|
| 40 | } |
||
| 41 | |||
| 42 | 91 | return $decoded->value; |
|
| 43 | } |
||
| 45 |