@@ 57-75 (lines=19) @@ | ||
54 | /** |
|
55 | * @return Version[] |
|
56 | */ |
|
57 | private function getSortedVersions(AvailableMigrationsList $availableMigrations, ExecutedMigrationsList $executedMigrations) : array |
|
58 | { |
|
59 | $availableVersions = array_map(static function (AvailableMigration $availableMigration) : Version { |
|
60 | return $availableMigration->getVersion(); |
|
61 | }, $availableMigrations->getItems()); |
|
62 | ||
63 | $executedVersions = array_map(static function (ExecutedMigration $executedMigration) : Version { |
|
64 | return $executedMigration->getVersion(); |
|
65 | }, $executedMigrations->getItems()); |
|
66 | ||
67 | $versions = array_unique(array_merge($availableVersions, $executedVersions)); |
|
68 | ||
69 | $comparator = $this->getDependencyFactory()->getVersionComparator(); |
|
70 | uasort($versions, static function (Version $a, Version $b) use ($comparator) : int { |
|
71 | return $comparator->compare($a, $b); |
|
72 | }); |
|
73 | ||
74 | return $versions; |
|
75 | } |
|
76 | } |
|
77 |
@@ 98-116 (lines=19) @@ | ||
95 | /** |
|
96 | * @return Version[] |
|
97 | */ |
|
98 | private function getSortedVersions(AvailableMigrationsList $newMigrations, ExecutedMigrationsList $executedUnavailableMigrations) : array |
|
99 | { |
|
100 | $executedUnavailableVersion = array_map(static function (ExecutedMigration $executedMigration) : Version { |
|
101 | return $executedMigration->getVersion(); |
|
102 | }, $executedUnavailableMigrations->getItems()); |
|
103 | ||
104 | $newVersions = array_map(static function (AvailableMigration $availableMigration) : Version { |
|
105 | return $availableMigration->getVersion(); |
|
106 | }, $newMigrations->getItems()); |
|
107 | ||
108 | $versions = array_unique(array_merge($executedUnavailableVersion, $newVersions)); |
|
109 | ||
110 | $comparator = $this->getDependencyFactory()->getVersionComparator(); |
|
111 | uasort($versions, static function (Version $a, Version $b) use ($comparator) : int { |
|
112 | return $comparator->compare($a, $b); |
|
113 | }); |
|
114 | ||
115 | return $versions; |
|
116 | } |
|
117 | } |
|
118 |