1 | <?php |
||
10 | class CompositeConstraint implements Constraint |
||
11 | { |
||
12 | public const OPERATOR_AND = 'AND'; |
||
13 | public const OPERATOR_OR = 'OR'; |
||
14 | |||
15 | /** @var string */ |
||
16 | protected $operator; |
||
17 | |||
18 | /** @var Constraint[] */ |
||
19 | protected $constraints; |
||
20 | |||
21 | 9 | public function __construct(string $operator, Constraint $constraint, Constraint ...$constraints) |
|
30 | |||
31 | 5 | public static function and(Constraint $constraint, Constraint ...$constraints): CompositeConstraint |
|
35 | |||
36 | 3 | public static function or(Constraint $constraint, Constraint ...$constraints): CompositeConstraint |
|
40 | |||
41 | 5 | public function getOperator(): string |
|
45 | |||
46 | 3 | public function getConstraints(): array |
|
50 | |||
51 | 2 | public function assert(Version $version): bool |
|
59 | |||
60 | 1 | protected function assertAnd(Version $version): bool |
|
70 | |||
71 | 1 | protected function assertOr(Version $version): bool |
|
81 | } |
||
82 |