Passed
Push — master ( 22b347...ceff3e )
by y
01:34
created

Num::toText()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Helix\DB\SQL;
4
5
/**
6
 * Represents a numeric expression. Produces various transformations.
7
 */
8
class Num extends Value {
9
10
    use NumTrait;
11
12
    /**
13
     * Casts the expression to a character string.
14
     *
15
     * @return Text
16
     */
17
    public function toText () {
18
        if ($this->db->isSQLite()) {
19
            return Text::factory($this->db, "CAST({$this} AS TEXT)");
20
        }
21
        return Text::factory($this->db, "CAST({$this} AS CHAR)");
22
    }
23
}