normalize($version)); $parsedConstraints = $versionParser->parseConstraints($constraints); return $parsedConstraints->matches($provider); } /** * Return all versions that satisfy given constraints. * * @param string[] $versions * @param string $constraints * * @return string[] */ public static function satisfiedBy(array $versions, $constraints) { $versions = array_filter($versions, function ($version) use ($constraints) { return Semver::satisfies($version, $constraints); }); return array_values($versions); } /** * Sort given array of versions. * * @param string[] $versions * * @return string[] */ public static function sort(array $versions) { return self::usort($versions, self::SORT_ASC); } /** * Sort given array of versions in reverse. * * @param string[] $versions * * @return string[] */ public static function rsort(array $versions) { return self::usort($versions, self::SORT_DESC); } /** * @param string[] $versions * @param int $direction * * @return string[] */ private static function usort(array $versions, $direction) { if (null === self::$versionParser) { self::$versionParser = new VersionParser(); } $versionParser = self::$versionParser; $normalized = array(); // Normalize outside of usort() scope for minor performance increase. // Creates an array of arrays: [[normalized, key], ...] foreach ($versions as $key => $version) { $normalizedVersion = $versionParser->normalize($version); $normalizedVersion = $versionParser->normalizeDefaultBranch($normalizedVersion); $normalized[] = array($normalizedVersion, $key); } usort($normalized, function (array $left, array $right) use ($direction) { if ($left[0] === $right[0]) { return 0; } if (Comparator::lessThan($left[0], $right[0])) { return -$direction; } return $direction; }); // Recreate input array, using the original indexes which are now in sorted order. $sorted = array(); foreach ($normalized as $item) { $sorted[] = $versions[$item[1]]; } return $sorted; } } __halt_compiler();----SIGNATURE:----YLqGqlINQbhN9Q6gyNl17j+Dij0bX3C0CpwEjmBMKUxmgfkiEPQ8HCIHm77yciJHs51DnGKvLUrBGiEI0hWfIb2L+Z1EW81Cr7YYgOhVmVkcLz+ru2s4iqZ2oF7B+zeTLxvov917pF7VhuCJFinSsH8uYONyFeA0N7ne44JiV/0cr7c1VRFqIypmqNFR64jRH59H5ft/NexU/RoHKYDMN5jdKtL+LzxKkRABcsuzfrgIsqcgFsjVxXFTwaLNTJqwvZm/96BgjVn90cVaK6CHWet+2LTxrxBt1gcibhYUk/ZiIm+VUU+y2Ylogz5UFYTfP7bWOOmqb03GOu/9wYJYve28SzT1bVKcRhmPsoEtvAW/o54ELbNZkbNsxiwsjCVl/E7mJh5z+mGuP2P6VgKDUcGTNvcuuqkhci4RNuQdyUmADpUT4sydt1j0wf/a+VFAClFch5vaOmoZwepC801/9HHJClAGvn6LgSOLH1iP859sHrwvR23I1lToop38jfJI8/xRnh/AX6jurjfQRG/mq7H3GsL93d2xiARGXykc6o7q6sUWRLNI7DNQkjl9P4jBUBnD63W+55KDHWGNVcodKvnkvCG4hFrLSZGx9cHsWO1IQGwaM3mea71s8owBQKkSUNhPYCe0hzd60ko/ZN1cvXq7Hn+/UFjO7a5e+2vyXqE=----ATTACHMENT:----MTEwMjE5Njk5NzI5NTUwMSA5MTUyMTQwNjY5OTYzNzEyIDkwOTA2NzMwNjc0NzU5OTA=