Passed
Push — master ( a5f56c...d0ba85 )
by y
01:34
created

Numeric::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 Numeric extends Scalar {
9
10
    use NumericTrait;
11
12
    /**
13
     * Casts the expression to a string of characters.
14
     *
15
     * @return Text
16
     */
17
    public function toText () {
18
        if ($this->db->getDriver() === 'sqlite') {
19
            return new Text($this->db, "CAST({$this} AS TEXT)");
20
        }
21
        return new Text($this->db, "CAST({$this} AS CHAR)");
22
    }
23
}