| Total Complexity | 7 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Coverage | 70% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class Criteria |
||
| 10 | { |
||
| 11 | private $sqlOperator; |
||
| 12 | |||
| 13 | private $field; |
||
| 14 | |||
| 15 | private $value; |
||
| 16 | |||
| 17 | public static function greaterThan(string $field, string $value): self |
||
| 18 | { |
||
| 19 | return new self(" > ", $field, $value); |
||
| 20 | } |
||
| 21 | |||
| 22 | public static function lessThan(string $field, string $value): self |
||
| 23 | { |
||
| 24 | return new self(" < ", $field, $value); |
||
| 25 | } |
||
| 26 | |||
| 27 | 2 | public static function equals(string $field, string $value): self |
|
| 28 | { |
||
| 29 | 2 | return new self(" = ", $field, $value); |
|
| 30 | } |
||
| 31 | |||
| 32 | public static function matches(string $field, string $value): self |
||
| 33 | { |
||
| 34 | return new self(" LIKE ", $field, $value); |
||
| 35 | } |
||
| 36 | |||
| 37 | 2 | private function __construct( |
|
| 38 | string $sqlOperator, |
||
| 39 | string $field, |
||
| 40 | string $value |
||
| 41 | ) { |
||
| 42 | 2 | $this->sqlOperator = $sqlOperator; |
|
| 43 | 2 | $this->field = $field; |
|
| 44 | 2 | $this->value = $value; |
|
| 45 | 2 | } |
|
| 46 | |||
| 47 | 2 | public function generateSql(DataMap $dataMap) |
|
| 53 | ); |
||
| 54 | } |
||
| 55 | |||
| 56 | 2 | public function getValue(): string |
|
| 59 | } |
||
| 60 | } |
||
| 61 |