| Total Complexity | 9 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Coverage | 94.12% |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 13 | final class AvailableMigrationsSet implements Countable |
||
| 14 | { |
||
| 15 | /** @var AvailableMigration[] */ |
||
| 16 | protected $items = []; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param AvailableMigration[] $items |
||
| 20 | */ |
||
| 21 | 77 | public function __construct(array $items) |
|
| 22 | { |
||
| 23 | 77 | $this->items = array_values($items); |
|
| 24 | 77 | } |
|
| 25 | |||
| 26 | /** |
||
| 27 | * @return AvailableMigration[] |
||
| 28 | */ |
||
| 29 | 70 | 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 |