Replace getHttpSupport() to getScheme()
parent
9b0e50cdc2
commit
86070a8b6e
|
@ -51,7 +51,7 @@ class GitBitbucketDriver extends VcsDriver implements VcsDriverInterface
|
||||||
public function getRootIdentifier()
|
public function getRootIdentifier()
|
||||||
{
|
{
|
||||||
if (null === $this->rootIdentifier) {
|
if (null === $this->rootIdentifier) {
|
||||||
$repoData = json_decode(file_get_contents($this->getHttpSupport() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository), true);
|
$repoData = json_decode(file_get_contents($this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository), true);
|
||||||
$this->rootIdentifier = !empty($repoData['main_branch']) ? $repoData['main_branch'] : 'master';
|
$this->rootIdentifier = !empty($repoData['main_branch']) ? $repoData['main_branch'] : 'master';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ class GitBitbucketDriver extends VcsDriver implements VcsDriverInterface
|
||||||
public function getDist($identifier)
|
public function getDist($identifier)
|
||||||
{
|
{
|
||||||
$label = array_search($identifier, $this->getTags()) ?: $identifier;
|
$label = array_search($identifier, $this->getTags()) ?: $identifier;
|
||||||
$url = $this->getHttpSupport() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$label.'.zip';
|
$url = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$label.'.zip';
|
||||||
|
|
||||||
return array('type' => 'zip', 'url' => $url, 'reference' => $label, 'shasum' => '');
|
return array('type' => 'zip', 'url' => $url, 'reference' => $label, 'shasum' => '');
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ class GitBitbucketDriver extends VcsDriver implements VcsDriverInterface
|
||||||
public function getComposerInformation($identifier)
|
public function getComposerInformation($identifier)
|
||||||
{
|
{
|
||||||
if (!isset($this->infoCache[$identifier])) {
|
if (!isset($this->infoCache[$identifier])) {
|
||||||
$composer = @file_get_contents($this->getHttpSupport() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/raw/'.$identifier.'/composer.json');
|
$composer = @file_get_contents($this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/raw/'.$identifier.'/composer.json');
|
||||||
if (!$composer) {
|
if (!$composer) {
|
||||||
throw new \UnexpectedValueException('Failed to retrieve composer information for identifier '.$identifier.' in '.$this->getUrl());
|
throw new \UnexpectedValueException('Failed to retrieve composer information for identifier '.$identifier.' in '.$this->getUrl());
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ class GitBitbucketDriver extends VcsDriver implements VcsDriverInterface
|
||||||
$composer = JsonFile::parseJson($composer);
|
$composer = JsonFile::parseJson($composer);
|
||||||
|
|
||||||
if (!isset($composer['time'])) {
|
if (!isset($composer['time'])) {
|
||||||
$changeset = json_decode(file_get_contents($this->getHttpSupport() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/changesets/'.$identifier), true);
|
$changeset = json_decode(file_get_contents($this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/changesets/'.$identifier), true);
|
||||||
$composer['time'] = $changeset['timestamp'];
|
$composer['time'] = $changeset['timestamp'];
|
||||||
}
|
}
|
||||||
$this->infoCache[$identifier] = $composer;
|
$this->infoCache[$identifier] = $composer;
|
||||||
|
@ -116,7 +116,7 @@ class GitBitbucketDriver extends VcsDriver implements VcsDriverInterface
|
||||||
public function getTags()
|
public function getTags()
|
||||||
{
|
{
|
||||||
if (null === $this->tags) {
|
if (null === $this->tags) {
|
||||||
$tagsData = json_decode(file_get_contents($this->getHttpSupport() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/tags'), true);
|
$tagsData = json_decode(file_get_contents($this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/tags'), true);
|
||||||
$this->tags = array();
|
$this->tags = array();
|
||||||
foreach ($tagsData as $tag => $data) {
|
foreach ($tagsData as $tag => $data) {
|
||||||
$this->tags[$tag] = $data['raw_node'];
|
$this->tags[$tag] = $data['raw_node'];
|
||||||
|
@ -132,7 +132,7 @@ class GitBitbucketDriver extends VcsDriver implements VcsDriverInterface
|
||||||
public function getBranches()
|
public function getBranches()
|
||||||
{
|
{
|
||||||
if (null === $this->branches) {
|
if (null === $this->branches) {
|
||||||
$branchData = json_decode(file_get_contents($this->getHttpSupport() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/branches'), true);
|
$branchData = json_decode(file_get_contents($this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/branches'), true);
|
||||||
$this->branches = array();
|
$this->branches = array();
|
||||||
foreach ($branchData as $branch => $data) {
|
foreach ($branchData as $branch => $data) {
|
||||||
$this->branches[$branch] = $data['raw_node'];
|
$this->branches[$branch] = $data['raw_node'];
|
||||||
|
|
|
@ -41,7 +41,7 @@ class GitHubDriver extends VcsDriver implements VcsDriverInterface
|
||||||
public function getRootIdentifier()
|
public function getRootIdentifier()
|
||||||
{
|
{
|
||||||
if (null === $this->rootIdentifier) {
|
if (null === $this->rootIdentifier) {
|
||||||
$repoData = json_decode(file_get_contents($this->getHttpSupport() . '://api.github.com/repos/'.$this->owner.'/'.$this->repository), true);
|
$repoData = json_decode(file_get_contents($this->getScheme() . '://api.github.com/repos/'.$this->owner.'/'.$this->repository), true);
|
||||||
$this->rootIdentifier = $repoData['master_branch'] ?: 'master';
|
$this->rootIdentifier = $repoData['master_branch'] ?: 'master';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ class GitHubDriver extends VcsDriver implements VcsDriverInterface
|
||||||
public function getDist($identifier)
|
public function getDist($identifier)
|
||||||
{
|
{
|
||||||
$label = array_search($identifier, $this->getTags()) ?: $identifier;
|
$label = array_search($identifier, $this->getTags()) ?: $identifier;
|
||||||
$url = $this->getHttpSupport() . '://github.com/'.$this->owner.'/'.$this->repository.'/zipball/'.$label;
|
$url = $this->getScheme() . '://github.com/'.$this->owner.'/'.$this->repository.'/zipball/'.$label;
|
||||||
|
|
||||||
return array('type' => 'zip', 'url' => $url, 'reference' => $label, 'shasum' => '');
|
return array('type' => 'zip', 'url' => $url, 'reference' => $label, 'shasum' => '');
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ class GitHubDriver extends VcsDriver implements VcsDriverInterface
|
||||||
public function getComposerInformation($identifier)
|
public function getComposerInformation($identifier)
|
||||||
{
|
{
|
||||||
if (!isset($this->infoCache[$identifier])) {
|
if (!isset($this->infoCache[$identifier])) {
|
||||||
$composer = @file_get_contents($this->getHttpSupport() . '://raw.github.com/'.$this->owner.'/'.$this->repository.'/'.$identifier.'/composer.json');
|
$composer = @file_get_contents($this->getScheme() . '://raw.github.com/'.$this->owner.'/'.$this->repository.'/'.$identifier.'/composer.json');
|
||||||
if (!$composer) {
|
if (!$composer) {
|
||||||
throw new \UnexpectedValueException('Failed to retrieve composer information for identifier '.$identifier.' in '.$this->getUrl());
|
throw new \UnexpectedValueException('Failed to retrieve composer information for identifier '.$identifier.' in '.$this->getUrl());
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ class GitHubDriver extends VcsDriver implements VcsDriverInterface
|
||||||
$composer = JsonFile::parseJson($composer);
|
$composer = JsonFile::parseJson($composer);
|
||||||
|
|
||||||
if (!isset($composer['time'])) {
|
if (!isset($composer['time'])) {
|
||||||
$commit = json_decode(file_get_contents($this->getHttpSupport() . '://api.github.com/repos/'.$this->owner.'/'.$this->repository.'/commits/'.$identifier), true);
|
$commit = json_decode(file_get_contents($this->getScheme() . '://api.github.com/repos/'.$this->owner.'/'.$this->repository.'/commits/'.$identifier), true);
|
||||||
$composer['time'] = $commit['commit']['committer']['date'];
|
$composer['time'] = $commit['commit']['committer']['date'];
|
||||||
}
|
}
|
||||||
$this->infoCache[$identifier] = $composer;
|
$this->infoCache[$identifier] = $composer;
|
||||||
|
@ -106,7 +106,7 @@ class GitHubDriver extends VcsDriver implements VcsDriverInterface
|
||||||
public function getTags()
|
public function getTags()
|
||||||
{
|
{
|
||||||
if (null === $this->tags) {
|
if (null === $this->tags) {
|
||||||
$tagsData = json_decode(file_get_contents($this->getHttpSupport() . '://api.github.com/repos/'.$this->owner.'/'.$this->repository.'/tags'), true);
|
$tagsData = json_decode(file_get_contents($this->getScheme() . '://api.github.com/repos/'.$this->owner.'/'.$this->repository.'/tags'), true);
|
||||||
$this->tags = array();
|
$this->tags = array();
|
||||||
foreach ($tagsData as $tag) {
|
foreach ($tagsData as $tag) {
|
||||||
$this->tags[$tag['name']] = $tag['commit']['sha'];
|
$this->tags[$tag['name']] = $tag['commit']['sha'];
|
||||||
|
@ -122,7 +122,7 @@ class GitHubDriver extends VcsDriver implements VcsDriverInterface
|
||||||
public function getBranches()
|
public function getBranches()
|
||||||
{
|
{
|
||||||
if (null === $this->branches) {
|
if (null === $this->branches) {
|
||||||
$branchData = json_decode(file_get_contents($this->getHttpSupport() . '://api.github.com/repos/'.$this->owner.'/'.$this->repository.'/branches'), true);
|
$branchData = json_decode(file_get_contents($this->getScheme() . '://api.github.com/repos/'.$this->owner.'/'.$this->repository.'/branches'), true);
|
||||||
$this->branches = array();
|
$this->branches = array();
|
||||||
foreach ($branchData as $branch) {
|
foreach ($branchData as $branch) {
|
||||||
$this->branches[$branch['name']] = $branch['commit']['sha'];
|
$this->branches[$branch['name']] = $branch['commit']['sha'];
|
||||||
|
|
|
@ -51,7 +51,7 @@ class HgBitbucketDriver extends VcsDriver implements VcsDriverInterface
|
||||||
public function getRootIdentifier()
|
public function getRootIdentifier()
|
||||||
{
|
{
|
||||||
if (null === $this->rootIdentifier) {
|
if (null === $this->rootIdentifier) {
|
||||||
$repoData = json_decode(file_get_contents($this->getHttpSupport() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/tags'), true);
|
$repoData = json_decode(file_get_contents($this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/tags'), true);
|
||||||
$this->rootIdentifier = $repoData['tip']['raw_node'];
|
$this->rootIdentifier = $repoData['tip']['raw_node'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ class HgBitbucketDriver extends VcsDriver implements VcsDriverInterface
|
||||||
public function getDist($identifier)
|
public function getDist($identifier)
|
||||||
{
|
{
|
||||||
$label = array_search($identifier, $this->getTags()) ?: $identifier;
|
$label = array_search($identifier, $this->getTags()) ?: $identifier;
|
||||||
$url = $this->getHttpSupport() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$label.'.zip';
|
$url = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$label.'.zip';
|
||||||
|
|
||||||
return array('type' => 'zip', 'url' => $url, 'reference' => $label, 'shasum' => '');
|
return array('type' => 'zip', 'url' => $url, 'reference' => $label, 'shasum' => '');
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ class HgBitbucketDriver extends VcsDriver implements VcsDriverInterface
|
||||||
public function getComposerInformation($identifier)
|
public function getComposerInformation($identifier)
|
||||||
{
|
{
|
||||||
if (!isset($this->infoCache[$identifier])) {
|
if (!isset($this->infoCache[$identifier])) {
|
||||||
$composer = @file_get_contents($this->getHttpSupport() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/raw/'.$identifier.'/composer.json');
|
$composer = @file_get_contents($this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/raw/'.$identifier.'/composer.json');
|
||||||
if (!$composer) {
|
if (!$composer) {
|
||||||
throw new \UnexpectedValueException('Failed to retrieve composer information for identifier '.$identifier.' in '.$this->getUrl());
|
throw new \UnexpectedValueException('Failed to retrieve composer information for identifier '.$identifier.' in '.$this->getUrl());
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ class HgBitbucketDriver extends VcsDriver implements VcsDriverInterface
|
||||||
$composer = JsonFile::parseJson($composer);
|
$composer = JsonFile::parseJson($composer);
|
||||||
|
|
||||||
if (!isset($composer['time'])) {
|
if (!isset($composer['time'])) {
|
||||||
$changeset = json_decode(file_get_contents($this->getHttpSupport() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/changesets/'.$identifier), true);
|
$changeset = json_decode(file_get_contents($this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/changesets/'.$identifier), true);
|
||||||
$composer['time'] = $changeset['timestamp'];
|
$composer['time'] = $changeset['timestamp'];
|
||||||
}
|
}
|
||||||
$this->infoCache[$identifier] = $composer;
|
$this->infoCache[$identifier] = $composer;
|
||||||
|
@ -116,7 +116,7 @@ class HgBitbucketDriver extends VcsDriver implements VcsDriverInterface
|
||||||
public function getTags()
|
public function getTags()
|
||||||
{
|
{
|
||||||
if (null === $this->tags) {
|
if (null === $this->tags) {
|
||||||
$tagsData = json_decode(file_get_contents($this->getHttpSupport() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/tags'), true);
|
$tagsData = json_decode(file_get_contents($this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/tags'), true);
|
||||||
$this->tags = array();
|
$this->tags = array();
|
||||||
foreach ($tagsData as $tag => $data) {
|
foreach ($tagsData as $tag => $data) {
|
||||||
$this->tags[$tag] = $data['raw_node'];
|
$this->tags[$tag] = $data['raw_node'];
|
||||||
|
@ -132,7 +132,7 @@ class HgBitbucketDriver extends VcsDriver implements VcsDriverInterface
|
||||||
public function getBranches()
|
public function getBranches()
|
||||||
{
|
{
|
||||||
if (null === $this->branches) {
|
if (null === $this->branches) {
|
||||||
$branchData = json_decode(file_get_contents($this->getHttpSupport() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/branches'), true);
|
$branchData = json_decode(file_get_contents($this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/branches'), true);
|
||||||
$this->branches = array();
|
$this->branches = array();
|
||||||
foreach ($branchData as $branch => $data) {
|
foreach ($branchData as $branch => $data) {
|
||||||
$this->branches[$branch] = $data['raw_node'];
|
$this->branches[$branch] = $data['raw_node'];
|
||||||
|
|
|
@ -46,7 +46,7 @@ abstract class VcsDriver
|
||||||
*
|
*
|
||||||
* @return string The correct type of protocol
|
* @return string The correct type of protocol
|
||||||
*/
|
*/
|
||||||
protected function getHttpSupport()
|
protected function getScheme()
|
||||||
{
|
{
|
||||||
if (extension_loaded('openssl')) {
|
if (extension_loaded('openssl')) {
|
||||||
return 'https';
|
return 'https';
|
||||||
|
|
Loading…
Reference in New Issue