Total Complexity | 9 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Coverage | 94.12% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | final class AvailableMigrationsSet implements Countable |
||
14 | { |
||
15 | /** @var AvailableMigration[] */ |
||
16 | private $items = []; |
||
17 | |||
18 | /** |
||
19 | * @param AvailableMigration[] $items |
||
20 | */ |
||
21 | 76 | public function __construct(array $items) |
|
22 | { |
||
23 | 76 | $this->items = array_values($items); |
|
24 | 76 | } |
|
25 | |||
26 | /** |
||
27 | * @return AvailableMigration[] |
||
28 | */ |
||
29 | 69 | public function getItems() : array |
|
32 | } |
||
33 | |||
34 | 7 | public function count() : int |
|
35 | { |
||
36 | 7 | return count($this->items); |
|
37 | } |
||
38 | |||
39 | 1 | public function hasMigration(Version $version) : bool |
|
40 | { |
||
41 | 1 | foreach ($this->items as $migration) { |
|
42 | 1 | if ($migration->getVersion()->equals($version)) { |
|
43 | 1 | return true; |
|
44 | } |
||
45 | } |
||
46 | |||
47 | 1 | return false; |
|
48 | } |
||
49 | |||
50 | 1 | public function getMigration(Version $version) : AvailableMigration |
|
59 | } |
||
60 | } |
||
61 |