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