Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
RawSql | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getSQL | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | namespace Flow\Data\Utils; |
4 | |
5 | /** |
6 | * Value class wraps sql to be passed into queries. Values |
7 | * that are not wrapped in the RawSql class are escaped to |
8 | * plain strings. |
9 | */ |
10 | class RawSql { |
11 | /** @var string|callable */ |
12 | protected $sql; |
13 | |
14 | public function __construct( $sql ) { |
15 | $this->sql = $sql; |
16 | } |
17 | |
18 | public function getSQL( $db ) { |
19 | if ( is_callable( $this->sql ) ) { |
20 | return ( $this->sql )( $db ); |
21 | } |
22 | |
23 | return $this->sql; |
24 | } |
25 | } |