public function getLatestVersion() { $releases = $this->getReleases(); $latestMajor = array_shift($releases); $latest = array_shift($latestMajor); if (!$latest) { throw new Exception('Latest major version not found.'); } return $latest['version']; }