1 | <?php |
||
13 | class CompositeConstraint implements ConstraintInterface |
||
14 | { |
||
15 | public const TYPE_AND = 'AND'; |
||
16 | public const TYPE_OR = 'OR'; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $type; |
||
22 | |||
23 | /** |
||
24 | * @var ConstraintInterface[] |
||
25 | */ |
||
26 | protected $constraints; |
||
27 | |||
28 | 9 | public function __construct(string $type, ConstraintInterface $constraint, ConstraintInterface ...$constraints) |
|
37 | |||
38 | 5 | public static function and(ConstraintInterface $constraint, ConstraintInterface ...$constraints) : CompositeConstraint |
|
42 | |||
43 | 3 | public static function or(ConstraintInterface $constraint, ConstraintInterface ...$constraints) : CompositeConstraint |
|
47 | |||
48 | 5 | public function getType() : string |
|
52 | |||
53 | 3 | public function getConstraints() : array |
|
57 | |||
58 | 2 | public function assert(Version $version) : bool |
|
66 | |||
67 | 1 | protected function assertAnd(Version $version) : bool |
|
77 | |||
78 | 1 | protected function assertOr(Version $version) : bool |
|
88 | } |
||
89 |