Fixed CS and unused variables
parent
ee4d4ee3fa
commit
3e5fd85768
|
@ -19,6 +19,7 @@ use Composer\Package\PackageInterface;
|
|||
*/
|
||||
class HgDownloader implements DownloaderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -50,8 +51,8 @@ class HgDownloader implements DownloaderInterface
|
|||
throw new \InvalidArgumentException('The given package is missing reference information');
|
||||
}
|
||||
|
||||
$this->enforceCleanDirectory($path);
|
||||
system(sprintf('cd %s && hg pull && hg up %s', $path, $target->getSourceReference()));
|
||||
$this->enforceCleanDirectory($path);
|
||||
system(sprintf('cd %s && hg pull && hg up %s', $path, $target->getSourceReference()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,7 +26,7 @@ class HgDriver implements VcsDriverInterface
|
|||
protected $infoCache = array();
|
||||
|
||||
public function __construct($url)
|
||||
{
|
||||
{
|
||||
$this->url = $url;
|
||||
$this->tmpDir = sys_get_temp_dir() . '/composer-' . preg_replace('{[^a-z0-9]}i', '-', $url) . '/';
|
||||
}
|
||||
|
@ -53,11 +53,11 @@ class HgDriver implements VcsDriverInterface
|
|||
*/
|
||||
public function getRootIdentifier()
|
||||
{
|
||||
$tmpDir = escapeshellarg($this->tmpDir);
|
||||
if (null === $this->rootIdentifier) {
|
||||
exec(sprintf('cd %s && hg tip --template "{rev}:{node|short}" --color never', $tmpDir), $output);
|
||||
$this->rootIdentifier = $output[0];
|
||||
}
|
||||
$tmpDir = escapeshellarg($this->tmpDir);
|
||||
if (null === $this->rootIdentifier) {
|
||||
exec(sprintf('cd %s && hg tip --template "{rev}:{node|short}" --color never', $tmpDir), $output);
|
||||
$this->rootIdentifier = $output[0];
|
||||
}
|
||||
return $this->rootIdentifier;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ class HgDriver implements VcsDriverInterface
|
|||
*/
|
||||
public function getSource($identifier)
|
||||
{
|
||||
$label = array_search($identifier, (array) $this->tags) ?: $identifier;
|
||||
$label = array_search($identifier, (array)$this->tags) ? : $identifier;
|
||||
|
||||
return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $label);
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ class HgDriver implements VcsDriverInterface
|
|||
unset($output);
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
$composer = JsonFile::parseJson($composer);
|
||||
|
@ -111,7 +111,7 @@ class HgDriver implements VcsDriverInterface
|
|||
$this->infoCache[$identifier] = $composer;
|
||||
}
|
||||
|
||||
return $this->infoCache[$identifier];
|
||||
return $this->infoCache[$identifier];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -121,12 +121,12 @@ class HgDriver implements VcsDriverInterface
|
|||
{
|
||||
if (null === $this->tags) {
|
||||
exec(sprintf('cd %s && hg tags --color never', escapeshellarg($this->tmpDir)), $output);
|
||||
foreach ($output as $key => $tag) {
|
||||
preg_match('(^([^\s]+)[\s]+[\d+]:(.*)$)', $tag, $match);
|
||||
$tags[$match[1]] = $match[2];
|
||||
}
|
||||
foreach ($output as $tag) {
|
||||
preg_match('(^([^\s]+)[\s]+[\d+]:(.*)$)', $tag, $match);
|
||||
$tags[$match[1]] = $match[2];
|
||||
}
|
||||
unset($tags['tip']);
|
||||
$this->tags = $tags;
|
||||
$this->tags = $tags;
|
||||
}
|
||||
|
||||
return $this->tags;
|
||||
|
@ -141,9 +141,9 @@ class HgDriver implements VcsDriverInterface
|
|||
$branches = array();
|
||||
|
||||
exec(sprintf('cd %s && hg branches --color never', escapeshellarg($this->tmpDir)), $output);
|
||||
foreach ($output as $key => $branch) {
|
||||
preg_match('(^([^\s]+)[\s]+[\d+]:(.*)$)', $branch, $match);
|
||||
$branches[$match[1]] = $match[2];
|
||||
foreach ($output as $branch) {
|
||||
preg_match('(^([^\s]+)[\s]+[\d+]:(.*)$)', $branch, $match);
|
||||
$branches[$match[1]] = $match[2];
|
||||
}
|
||||
|
||||
$this->branches = $branches;
|
||||
|
@ -171,7 +171,7 @@ class HgDriver implements VcsDriverInterface
|
|||
*/
|
||||
public static function supports($url, $deep = false)
|
||||
{
|
||||
if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
|
||||
if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -179,8 +179,8 @@ class HgDriver implements VcsDriverInterface
|
|||
return false;
|
||||
}
|
||||
|
||||
exec(sprintf('hg identify %s', escapeshellarg($url)), $output);
|
||||
exec(sprintf('hg identify %s', escapeshellarg($url)), $output);
|
||||
|
||||
return (boolean) $output;
|
||||
return (boolean)$output;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue