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