| @@ 31-44 (lines=14) @@ | ||
| 28 | private $field; |
|
| 29 | private $value; |
|
| 30 | ||
| 31 | public function __construct(string $comparator, $field, $value) |
|
| 32 | { |
|
| 33 | if (!in_array($comparator, self::$validTypes)) { |
|
| 34 | throw new \InvalidArgumentException(sprintf( |
|
| 35 | 'Unknown comparator "%s". Known comparators: "%s"', |
|
| 36 | $comparator, |
|
| 37 | implode('", "', self::$validTypes) |
|
| 38 | )); |
|
| 39 | } |
|
| 40 | ||
| 41 | $this->comparator = $comparator; |
|
| 42 | $this->field = $field; |
|
| 43 | $this->value = $value; |
|
| 44 | } |
|
| 45 | ||
| 46 | public function getComparator() |
|
| 47 | { |
|
| @@ 20-35 (lines=16) @@ | ||
| 17 | private $expressions; |
|
| 18 | private $type; |
|
| 19 | ||
| 20 | public function __construct(string $type, array $expressions) |
|
| 21 | { |
|
| 22 | // ensure types |
|
| 23 | array_map(function (Expression $expr) { |
|
| 24 | }, $expressions); |
|
| 25 | ||
| 26 | if (!in_array($type, self::$validTypes)) { |
|
| 27 | throw new \InvalidArgumentException(sprintf( |
|
| 28 | 'Invalid composite type "%s", must be one of "%s"', |
|
| 29 | $type, implode('", "', self::$validTypes) |
|
| 30 | )); |
|
| 31 | } |
|
| 32 | ||
| 33 | $this->expressions = $expressions; |
|
| 34 | $this->type = $type; |
|
| 35 | } |
|
| 36 | ||
| 37 | public function getExpressions() |
|
| 38 | { |
|