|
@@ -9,6 +9,7 @@ class GitHubRepository implements RepositoryInterface
|
|
protected $repositoryData;
|
|
protected $repositoryData;
|
|
protected $tags;
|
|
protected $tags;
|
|
protected $branches;
|
|
protected $branches;
|
|
|
|
+ protected $infoCache = array();
|
|
|
|
|
|
public function __construct($url)
|
|
public function __construct($url)
|
|
{
|
|
{
|
|
@@ -25,6 +26,14 @@ class GitHubRepository implements RepositoryInterface
|
|
return 'git';
|
|
return 'git';
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * {@inheritDoc}
|
|
|
|
+ */
|
|
|
|
+ public function getRootIdentifier()
|
|
|
|
+ {
|
|
|
|
+ return 'master';
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* {@inheritDoc}
|
|
* {@inheritDoc}
|
|
*/
|
|
*/
|
|
@@ -55,17 +64,20 @@ class GitHubRepository implements RepositoryInterface
|
|
*/
|
|
*/
|
|
public function getComposerInformation($identifier)
|
|
public function getComposerInformation($identifier)
|
|
{
|
|
{
|
|
- $composer = json_decode(@file_get_contents('https://raw.github.com/'.$this->owner.'/'.$this->repository.'/'.$identifier.'/composer.json'), true);
|
|
|
|
- if (!$composer) {
|
|
|
|
- throw new \UnexpectedValueException('Failed to download retrieve composer information for identifier '.$identifier.' in '.$this->getUrl());
|
|
|
|
- }
|
|
|
|
|
|
+ if (!isset($this->infoCache[$identifier])) {
|
|
|
|
+ $composer = json_decode(@file_get_contents('https://raw.github.com/'.$this->owner.'/'.$this->repository.'/'.$identifier.'/composer.json'), true);
|
|
|
|
+ if (!$composer) {
|
|
|
|
+ throw new \UnexpectedValueException('Failed to download retrieve composer information for identifier '.$identifier.' in '.$this->getUrl());
|
|
|
|
+ }
|
|
|
|
|
|
- if (!isset($composer['time'])) {
|
|
|
|
- $commit = json_decode(file_get_contents('http://github.com/api/v2/json/commits/show/'.$this->owner.'/'.$this->repository.'/'.$identifier), true);
|
|
|
|
- $composer['time'] = $commit['commit']['committed_date'];
|
|
|
|
|
|
+ if (!isset($composer['time'])) {
|
|
|
|
+ $commit = json_decode(file_get_contents('http://github.com/api/v2/json/commits/show/'.$this->owner.'/'.$this->repository.'/'.$identifier), true);
|
|
|
|
+ $composer['time'] = $commit['commit']['committed_date'];
|
|
|
|
+ }
|
|
|
|
+ $this->infoCache[$identifier] = $composer;
|
|
}
|
|
}
|
|
|
|
|
|
- return $composer;
|
|
|
|
|
|
+ return $this->infoCache[$identifier];
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|