private function checkVersion() { $protocol = extension_loaded('openssl') ? 'https' : 'http'; $latest = trim($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/version', false)); if (Composer::VERSION !== $latest && Composer::VERSION !== '@package_version@') { return '<comment>You are not running the latest version</comment>'; } return true; }
/** * @param string $domain * @param string $token * @throws TransportException * @return array */ private function getGithubRateLimit($domain, $token = null) { if ($token) { $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic'); } $url = $domain === 'github.com' ? 'https://api.' . $domain . '/rate_limit' : 'https://' . $domain . '/api/rate_limit'; $json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false)); $data = json_decode($json, true); return $data['resources']['core']; }