| 148 |
lars |
1 |
<?php declare(strict_types = 1);
|
|
|
2 |
/*
|
|
|
3 |
* This file is part of PharIo\Manifest.
|
|
|
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\Manifest;
|
|
|
11 |
|
|
|
12 |
class RequirementCollection implements \Countable, \IteratorAggregate {
|
|
|
13 |
/** @var Requirement[] */
|
|
|
14 |
private $requirements = [];
|
|
|
15 |
|
|
|
16 |
public function add(Requirement $requirement): void {
|
|
|
17 |
$this->requirements[] = $requirement;
|
|
|
18 |
}
|
|
|
19 |
|
|
|
20 |
/**
|
|
|
21 |
* @return Requirement[]
|
|
|
22 |
*/
|
|
|
23 |
public function getRequirements(): array {
|
|
|
24 |
return $this->requirements;
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
public function count(): int {
|
|
|
28 |
return \count($this->requirements);
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
public function getIterator(): RequirementCollectionIterator {
|
|
|
32 |
return new RequirementCollectionIterator($this);
|
|
|
33 |
}
|
|
|
34 |
}
|