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()){
73 $indexedVersions = [];
75 foreach($versions as $str){
77 if($v->getSuffix() !==
""){
80 if(!isset($indexedVersions[$v->getMajor()])){
81 $indexedVersions[$v->getMajor()] = [$v];
83 $indexedVersions[$v->getMajor()][] = $v;
88 foreach($indexedVersions as $list){
90 array_push($result, ...$list);
94 usort($result,
static function(VersionString $string1, VersionString $string2) :
int{
return $string1->compare($string2); });
96 return array_map(
static function(VersionString $string) :
string{
return $string->getBaseVersion(); }, $result);