public function Project::getRecommendedOrSupportedRelease

8.0.x Project.php public Project::getRecommendedOrSupportedRelease()
7.x Project.php public Project::getRecommendedOrSupportedRelease()
master Project.php public Project::getRecommendedOrSupportedRelease()

Pick most appropriate release from XML list.

Return value

array|bool The selected release xml object or FALSE.

File

lib/Drush/UpdateService/Project.php, line 389

Namespace

Drush\UpdateService

Class

Project
Representation of a project's release info from the update service.

Code

public function getRecommendedOrSupportedRelease() {
  $majors = array();
  if (!empty($this->parsed['recommended_major']) || $this->parsed['recommended_major'] == 0) {
    $majors[] = $this->parsed['recommended_major'];
  }
  if (!empty($this->parsed['supported_majors'])) {
    $supported = explode(',', $this->parsed['supported_majors']);
    foreach ($supported as $v) {
      if ($v != $recommended_major) {
        $majors[] = $v;
      }
    }
  }
  $releases = array();
  foreach ($majors as $major) {
    $releases = $this->searchReleases('version_major', $major);
    if (!empty($releases)) {
      break;
    }
  }

  return self::getBestRelease($releases);
}