| Total Complexity | 5 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class DoubleColumn extends Column |
||
| 11 | { |
||
| 12 | public function __construct( |
||
| 13 | string|null $type = SchemaInterface::TYPE_DOUBLE, |
||
| 14 | string|null $phpType = SchemaInterface::PHP_TYPE_DOUBLE, |
||
| 15 | ) { |
||
| 16 | parent::__construct($type, $phpType); |
||
| 17 | } |
||
| 18 | |||
| 19 | public function dbTypecast(mixed $value): float|ExpressionInterface|null |
||
| 20 | { |
||
| 21 | if ($value instanceof ExpressionInterface) { |
||
| 22 | return $value; |
||
| 23 | } |
||
| 24 | |||
| 25 | return match ($value) { |
||
| 26 | null, '' => null, |
||
| 27 | default => (float) $value, |
||
| 28 | }; |
||
| 29 | } |
||
| 30 | |||
| 31 | public function phpTypecast(mixed $value): float|null |
||
| 38 | } |
||
| 39 | } |
||
| 40 |