| Total Complexity | 11 |
| Total Lines | 77 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 5 | abstract class Range |
||
| 6 | { |
||
| 7 | protected string $fromBound; |
||
| 8 | protected string $toBound; |
||
| 9 | protected ?string $from; |
||
| 10 | protected ?string $to; |
||
| 11 | |||
| 12 | public function __construct(string $from = null, string $to = null, $fromBound = '[', $toBound = ')') |
||
| 13 | { |
||
| 14 | $this->from = $from; |
||
| 15 | $this->to = $to; |
||
| 16 | $this->fromBound = $fromBound; |
||
| 17 | $this->toBound = $toBound; |
||
| 18 | |||
| 19 | $this->checkForEmptyBoundaries(); |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @return mixed |
||
| 24 | */ |
||
| 25 | public function from() |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param string $boundary |
||
| 36 | * @return mixed |
||
| 37 | */ |
||
| 38 | abstract protected function transformBoundary(string $boundary); |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @return mixed |
||
| 42 | */ |
||
| 43 | public function to() |
||
| 50 | } |
||
| 51 | |||
| 52 | public function hasLowerBoundary(): bool |
||
| 55 | } |
||
| 56 | |||
| 57 | public function hasUpperBoundary(): bool |
||
| 58 | { |
||
| 59 | return $this->to !== null; |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * @return string |
||
| 64 | */ |
||
| 65 | public function __toString() |
||
| 68 | } |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @return string |
||
| 72 | */ |
||
| 73 | abstract public function forSql(): string; |
||
| 74 | |||
| 75 | private function checkForEmptyBoundaries(): void |
||
| 82 | } |
||
| 83 | } |
||
| 85 |