41 public static function isCompatible(
string $myVersionStr, array $wantVersionsStr) : bool{
43 foreach($wantVersionsStr as $versionStr){
47 if($version->getBaseVersion() !== $myVersion->getBaseVersion()){
48 if($version->getMajor() !== $myVersion->getMajor()){
52 if($version->getMinor() > $myVersion->getMinor()){
56 if($version->getMinor() === $myVersion->getMinor() && $version->getPatch() > $myVersion->getPatch()){
74 $indexedVersions = [];
76 foreach($versions as $str){
78 if($v->getSuffix() !==
""){
81 if(!isset($indexedVersions[$v->getMajor()])){
82 $indexedVersions[$v->getMajor()] = [$v];
84 $indexedVersions[$v->getMajor()][] = $v;
90 foreach($indexedVersions as $major => $list){
92 array_push($result, ...$list);
96 usort($result,
static function(VersionString $string1, VersionString $string2) :
int{
return $string1->compare($string2); });
98 return array_map(
static function(VersionString $string) :
string{
return $string->getBaseVersion(); }, $result);