private function getComposerReleases($url, $limit = 10, $unstable = false)
    {
        if (!$url) {
            return [];
        }

        $packagistResponse = $this->httpClient->getUrlAsString($url);

        if ($packagistResponse->getStatusCode() != 200) {
            throw new \Exception('Invalid path.');
        }

        try {
            $packagistJson = json_decode(
                $packagistResponse->getBody()->getContents()
            );
        } catch (\Exception $e) {
            return [];
        }

        $versions = array_keys((array)$packagistJson->package->versions);

        // Remove Drupal 7 versions
        $i = 0;
        foreach ($versions as $version) {
            if (0 === strpos($version, "7.") || 0 === strpos($version, "dev-7.")) {
                unset($versions[$i]);
            }
            $i++;
        }

        if (!$unstable) {
            foreach ($versions as $key => $version) {
                if (strpos($version, "-")) {
                    unset($versions[$key]);
                }
            }
        }

        if (is_array($versions)) {
            return array_slice($versions, 0, $limit);
        }

        return [];
    }
private function getComposerReleases($url, $limit = 10, $unstable = false)
    {
        if (!$url) {
            return [];
        }

        $packagistResponse = $this->httpClient->getUrlAsString($url);

        if ($packagistResponse->getStatusCode() != 200) {
            throw new \Exception('Invalid path.');
        }

        try {
            $packagistJson = json_decode(
                $packagistResponse->getBody()->getContents()
            );
        } catch (\Exception $e) {
            return [];
        }

        $versions = array_keys((array)$packagistJson->package->versions);

        // Remove Drupal 7 versions
        $i = 0;
        foreach ($versions as $version) {
            if (0 === strpos($version, "7.") || 0 === strpos($version, "dev-7.")) {
                unset($versions[$i]);
            }
            $i++;
        }

        if (!$unstable) {
            foreach ($versions as $key => $version) {
                if (strpos($version, "-")) {
                    unset($versions[$key]);
                }
            }
        }

        if (is_array($versions)) {
            return array_slice($versions, 0, $limit);
        }

        return [];
    }
private function getComposerReleases ( $ url , $ limit = 10 , $ unstable = false ) { if ( ! $ url ) { return [ ] ; } $ packagistResponse = $ this -> httpClient -> getUrlAsString ( $ url ) ; if ( $ packagistResponse -> getStatusCode ( ) != 200 ) { throw new \ Exception ( 'Invalid path.' ) ; } try { $ packagistJson = json_decode ( $ packagistResponse -> getBody ( ) -> getContents ( ) ) ; } catch ( \ Exception $ e ) { return [ ] ; } $ versions = array_keys ( ( array ) $ packagistJson -> package -> versions ) ; // Remove Drupal 7 versions $ i = 0 ; foreach ( $ versions as $ version ) { if ( 0 === strpos ( $ version , "7." ) || 0 === strpos ( $ version , "dev-7." ) ) { unset ( $ versions [ $ i ] ) ; } $ i ++ ; } if ( ! $ unstable ) { foreach ( $ versions as $ key => $ version ) { if ( strpos ( $ version , "-" ) ) { unset ( $ versions [ $ key ] ) ; } } } if ( is_array ( $ versions ) ) { return array_slice ( $ versions , 0 , $ limit ) ; } return [ ] ; }
Gets Drupal releases from Packagist API.

@param string $url
@param int    $limit
@param bool   $unstable

@return array
Gets Drupal releases from Packagist API .