Пример #1
0
 /**
  * Find the maximum satisfying version
  * @param  array|string                        $versions An array of version objects or version strings, one version string
  * @return \vierbergenlars\SemVer\version|null
  */
 public function maxSatisfying($versions)
 {
     if (!is_array($versions)) {
         $versions = array($versions);
     }
     usort($versions, __NAMESPACE__ . '\\version::rcompare');
     foreach ($versions as $version) {
         try {
             if (!is_a($version, 'version')) {
                 $version = new version($version);
             }
         } catch (SemVerException $e) {
             // Invalid versions do never match
             continue;
         }
         if ($version->satisfies($this)) {
             return $version;
         }
     }
     return null;
 }