| Total Complexity | 8 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | final class Operator |
||
| 8 | { |
||
| 9 | private $operator; |
||
| 10 | |||
| 11 | private function __construct(array $params) |
||
| 12 | { |
||
| 13 | $this->operator = $params['operator']; |
||
| 14 | } |
||
| 15 | |||
| 16 | public static function fromRawValue(array $operator) : Operator |
||
| 17 | { |
||
| 18 | return new self([ |
||
| 19 | 'operator' => $operator, |
||
| 20 | ]); |
||
| 21 | } |
||
| 22 | |||
| 23 | public static function fromFilteringObject( |
||
| 24 | FilteringObject $filteringObject |
||
| 25 | ) : Operator { |
||
| 26 | $operator = Operators::get($filteringObject->getOperator()); |
||
| 27 | |||
| 28 | return new self([ |
||
| 29 | 'operator' => $operator, |
||
| 30 | ]); |
||
| 31 | } |
||
| 32 | |||
| 33 | public static function getDefault() |
||
| 34 | { |
||
| 35 | $operator = Operators::getDefaultOperator(); |
||
| 36 | |||
| 37 | return new self([ |
||
| 38 | 'operator' => $operator, |
||
| 39 | ]); |
||
| 40 | } |
||
| 41 | |||
| 42 | public function getRawValue() |
||
| 43 | { |
||
| 44 | return $this->operator; |
||
| 45 | } |
||
| 46 | |||
| 47 | public function getMeta() |
||
| 48 | { |
||
| 49 | $this->ensureMetaIsDefined(); |
||
| 50 | |||
| 51 | return $this->operator['meta']; |
||
| 52 | } |
||
| 53 | |||
| 54 | private function ensureMetaIsDefined() |
||
| 59 | ); |
||
| 60 | } |
||
| 61 | } |
||
| 62 | } |
||
| 63 |