Total Complexity | 4 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
8 | trait NumCastTrait { |
||
9 | |||
10 | use AbstractTrait; |
||
11 | |||
12 | /** |
||
13 | * Casts the expression as a floating point number. |
||
14 | * |
||
15 | * @return Num |
||
16 | */ |
||
17 | public function toFloat () { |
||
18 | if ($this->db->isSQLite()) { |
||
19 | return Num::factory($this->db, "CAST({$this} AS REAL)"); |
||
20 | } |
||
21 | return Num::factory($this->db, "({$this} + 0)"); |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * Casts the expression as a signed integer. |
||
26 | * |
||
27 | * @return Num |
||
28 | */ |
||
29 | public function toInt () { |
||
34 | } |
||
35 | } |
||
36 |