1 | <?php |
||
15 | class Constraint implements ConstraintInterface |
||
16 | { |
||
17 | public const OPERATOR_EQ = '='; |
||
18 | public const OPERATOR_NEQ = '!='; |
||
19 | public const OPERATOR_GT = '>'; |
||
20 | public const OPERATOR_GTE = '>='; |
||
21 | public const OPERATOR_LT = '<'; |
||
22 | public const OPERATOR_LTE = '<='; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $operator; |
||
28 | |||
29 | /** |
||
30 | * @var Version |
||
31 | */ |
||
32 | protected $operand; |
||
33 | |||
34 | /** |
||
35 | * @var array |
||
36 | */ |
||
37 | private static $validOperators = [ |
||
38 | self::OPERATOR_EQ, |
||
39 | self::OPERATOR_NEQ, |
||
40 | self::OPERATOR_GT, |
||
41 | self::OPERATOR_GTE, |
||
42 | self::OPERATOR_LT, |
||
43 | self::OPERATOR_LTE, |
||
44 | ]; |
||
45 | |||
46 | /** |
||
47 | * @var ParserInterface |
||
48 | */ |
||
49 | private static $parser; |
||
50 | |||
51 | 15 | protected function __construct(string $operator, Version $operand) |
|
56 | |||
57 | 16 | public static function fromProperties(string $operator, Version $operand) : Constraint |
|
63 | |||
64 | 3 | public static function fromString(string $constraintString) : Constraint |
|
68 | |||
69 | 16 | protected static function validateOperator(string $operator) : void |
|
75 | |||
76 | 3 | public static function getParser() : ParserInterface |
|
84 | |||
85 | 1 | public static function setParser(ParserInterface $parser) : void |
|
89 | |||
90 | 5 | public function getOperator() : string |
|
94 | |||
95 | 5 | public function getOperand() : Version |
|
99 | |||
100 | 11 | public function assert(Version $version) : bool |
|
119 | } |
||
120 |