| 148 |
lars |
1 |
<?php declare(strict_types = 1);
|
|
|
2 |
/*
|
|
|
3 |
* This file is part of PharIo\Version.
|
|
|
4 |
*
|
|
|
5 |
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
|
|
6 |
*
|
|
|
7 |
* For the full copyright and license information, please view the LICENSE
|
|
|
8 |
* file that was distributed with this source code.
|
|
|
9 |
*/
|
|
|
10 |
namespace PharIo\Version;
|
|
|
11 |
|
|
|
12 |
class AndVersionConstraintGroup extends AbstractVersionConstraint {
|
|
|
13 |
/** @var VersionConstraint[] */
|
|
|
14 |
private $constraints = [];
|
|
|
15 |
|
|
|
16 |
/**
|
|
|
17 |
* @param VersionConstraint[] $constraints
|
|
|
18 |
*/
|
|
|
19 |
public function __construct(string $originalValue, array $constraints) {
|
|
|
20 |
parent::__construct($originalValue);
|
|
|
21 |
|
|
|
22 |
$this->constraints = $constraints;
|
|
|
23 |
}
|
|
|
24 |
|
|
|
25 |
public function complies(Version $version): bool {
|
|
|
26 |
foreach ($this->constraints as $constraint) {
|
|
|
27 |
if (!$constraint->complies($version)) {
|
|
|
28 |
return false;
|
|
|
29 |
}
|
|
|
30 |
}
|
|
|
31 |
|
|
|
32 |
return true;
|
|
|
33 |
}
|
|
|
34 |
}
|