1 | <?php |
||
11 | class OperationConstraint implements Constraint |
||
12 | { |
||
13 | public const OPERATOR_EQ = '='; |
||
14 | public const OPERATOR_NEQ = '!='; |
||
15 | public const OPERATOR_GT = '>'; |
||
16 | public const OPERATOR_GTE = '>='; |
||
17 | public const OPERATOR_LT = '<'; |
||
18 | public const OPERATOR_LTE = '<='; |
||
19 | |||
20 | /** @var string */ |
||
21 | protected $operator; |
||
22 | |||
23 | /** @var Version */ |
||
24 | protected $operand; |
||
25 | |||
26 | 17 | public function __construct(string $operator, Version $operand) |
|
33 | |||
34 | /** |
||
35 | * @param string $constraintString |
||
36 | * @return OperationConstraint|CompositeConstraint |
||
37 | */ |
||
38 | 13 | public static function fromString(string $constraintString) |
|
48 | |||
49 | 5 | public function getOperator(): string |
|
53 | |||
54 | 5 | public function getOperand(): Version |
|
58 | |||
59 | 12 | public function assert(Version $version): bool |
|
76 | |||
77 | 17 | protected function validateOperator($operator): void |
|
89 | } |
||
90 |