Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| Expression | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| __toString | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace BO\Zmsdb\Query\Builder; |
| 4 | |
| 5 | /** |
| 6 | * Expression |
| 7 | * |
| 8 | * This class serves as a way of passing SQL expressions into a query |
| 9 | * thereby marking them exempt from quotation by the Dialect (either field or table). |
| 10 | * |
| 11 | * It goes without saying, expressions are an SQL injection vulnerability. ONLY |
| 12 | * use them on data you 100% trust. And seriously reconsider trusting it. |
| 13 | * |
| 14 | * @package BO\Zmsdb\Query\Builder |
| 15 | * @author Alex Gisby<alex@solution10.com> |
| 16 | * @license MIT |
| 17 | */ |
| 18 | class Expression implements ExpressionInterface |
| 19 | { |
| 20 | /** |
| 21 | * @var string |
| 22 | */ |
| 23 | protected $expression; |
| 24 | |
| 25 | /** |
| 26 | * Pass in the expression you want exempted. |
| 27 | * |
| 28 | * @param string $exp |
| 29 | */ |
| 30 | public function __construct($exp) |
| 31 | { |
| 32 | $this->expression = $exp; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Returns this expression as a string to make concatenation easier. |
| 37 | * |
| 38 | * @return string |
| 39 | */ |
| 40 | public function __toString() |
| 41 | { |
| 42 | return $this->expression; |
| 43 | } |
| 44 | } |