| @@ 40-52 (lines=13) @@ | ||
| 37 | */ |
|
| 38 | private static function compareIdentifiers(array $preReleaseIdentifiers1, array $preReleaseIdentifiers2) : int |
|
| 39 | { |
|
| 40 | do { |
|
| 41 | $preReleasePart1 = array_shift($preReleaseIdentifiers1); |
|
| 42 | $preReleasePart2 = array_shift($preReleaseIdentifiers2); |
|
| 43 | if (null === $preReleasePart1) { |
|
| 44 | return -1; |
|
| 45 | } |
|
| 46 | ||
| 47 | if (null === $preReleasePart2) { |
|
| 48 | return 1; |
|
| 49 | } |
|
| 50 | ||
| 51 | $compare = self::compareIdentifier($preReleasePart1, $preReleasePart2); |
|
| 52 | } while (0 === $compare && (count($preReleaseIdentifiers1) || count($preReleaseIdentifiers2))); |
|
| 53 | ||
| 54 | return $compare; |
|
| 55 | } |
|
| @@ 81-97 (lines=17) @@ | ||
| 78 | $preReleaseIdentifiers1 = explode('.', $preRelease1); |
|
| 79 | $preReleaseIdentifiers2 = explode('.', $preRelease2); |
|
| 80 | ||
| 81 | do { |
|
| 82 | $preReleasePart1 = array_shift($preReleaseIdentifiers1); |
|
| 83 | $preReleasePart2 = array_shift($preReleaseIdentifiers2); |
|
| 84 | ||
| 85 | if (null === $preReleasePart1) { |
|
| 86 | return -1; |
|
| 87 | } |
|
| 88 | ||
| 89 | if (null === $preReleasePart2) { |
|
| 90 | return 1; |
|
| 91 | } |
|
| 92 | ||
| 93 | $compare = static::comparePreReleasePart($preReleasePart1, $preReleasePart2); |
|
| 94 | if (0 !== $compare) { |
|
| 95 | return $compare; |
|
| 96 | } |
|
| 97 | } while (count($preReleaseIdentifiers1) || count($preReleaseIdentifiers2)); |
|
| 98 | ||
| 99 | return 0; |
|
| 100 | } |
|