1 | <?php |
||
16 | class ComparisonConstraint implements ConstraintInterface |
||
17 | { |
||
18 | public const OPERATOR_EQ = '='; |
||
19 | public const OPERATOR_NEQ = '!='; |
||
20 | public const OPERATOR_GT = '>'; |
||
21 | public const OPERATOR_GTE = '>='; |
||
22 | public const OPERATOR_LT = '<'; |
||
23 | public const OPERATOR_LTE = '<='; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $operator; |
||
29 | |||
30 | /** |
||
31 | * @var Version |
||
32 | */ |
||
33 | protected $operand; |
||
34 | |||
35 | 15 | public function __construct(string $operator, Version $operand) |
|
42 | |||
43 | /** |
||
44 | * @param string $constraintString |
||
45 | * @return ComparisonConstraint|CompositeConstraint |
||
46 | */ |
||
47 | 11 | public static function fromString(string $constraintString) |
|
57 | |||
58 | 5 | public function getOperator() : string |
|
62 | |||
63 | 5 | public function getOperand() : Version |
|
67 | |||
68 | 10 | public function assert(Version $version) : bool |
|
85 | |||
86 | 15 | protected function validateOperator($operator) : void |
|
98 | } |
||
99 |