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