| Total Complexity | 5 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | final class ValueTypecasting |
||
| 21 | { |
||
| 22 | |||
| 23 | private const DEFINABLE_TYPES_MAP = [ |
||
| 24 | IntType::class, |
||
| 25 | FloatType::class, |
||
| 26 | TrueType::class, |
||
| 27 | FalseType::class, |
||
| 28 | NullType::class, |
||
| 29 | BoolType::class, |
||
| 30 | StringType::class, |
||
| 31 | Int8Type::class, |
||
| 32 | Int16Type::class |
||
| 33 | ]; |
||
| 34 | |||
| 35 | private float|bool|int|string|null $castedValue; |
||
| 36 | |||
| 37 | 34 | public function __construct(private string $originalValue) |
|
| 38 | { |
||
| 39 | 34 | $this->castedValue = $this->originalValue; |
|
| 40 | 34 | $this->determine(); |
|
| 41 | } |
||
| 42 | |||
| 43 | 34 | public function getCastValue(): float|bool|int|string|null |
|
| 46 | } |
||
| 47 | |||
| 48 | 34 | private function determine(): void |
|
| 63 |