mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
CS fixes
This commit is contained in:
parent
7211eedc36
commit
122e422682
98 changed files with 503 additions and 413 deletions
|
@ -266,7 +266,7 @@ class PlatformRepository extends ArrayRepository
|
|||
/**
|
||||
* Parses the version and adds a new package to the repository
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $name
|
||||
* @param null|string $prettyVersion
|
||||
*/
|
||||
private function addExtension($name, $prettyVersion)
|
||||
|
|
|
@ -65,8 +65,8 @@ interface RepositoryInterface extends \Countable
|
|||
/**
|
||||
* Searches the repository for packages containing the query
|
||||
*
|
||||
* @param string $query search query
|
||||
* @param int $mode a set of SEARCH_* constants to search on, implementations should do a best effort only
|
||||
* @param string $query search query
|
||||
* @param int $mode a set of SEARCH_* constants to search on, implementations should do a best effort only
|
||||
*
|
||||
* @return \array[] an array of array('name' => '...', 'description' => '...')
|
||||
*/
|
||||
|
|
|
@ -56,7 +56,7 @@ abstract class BitbucketDriver extends VcsDriver
|
|||
$this->config->get('cache-repo-dir'),
|
||||
$this->originUrl,
|
||||
$this->owner,
|
||||
$this->repository
|
||||
$this->repository,
|
||||
))
|
||||
);
|
||||
}
|
||||
|
@ -104,6 +104,7 @@ abstract class BitbucketDriver extends VcsDriver
|
|||
$this->homeUrl = $repoData['links']['html']['href'];
|
||||
$this->website = $repoData['website'];
|
||||
$this->vcsType = $repoData['scm'];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -268,7 +269,7 @@ abstract class BitbucketDriver extends VcsDriver
|
|||
array(
|
||||
'pagelen' => 100,
|
||||
'fields' => 'values.name,values.target.hash,next',
|
||||
'sort' => '-target.date'
|
||||
'sort' => '-target.date',
|
||||
),
|
||||
null,
|
||||
'&'
|
||||
|
@ -312,7 +313,7 @@ abstract class BitbucketDriver extends VcsDriver
|
|||
array(
|
||||
'pagelen' => 100,
|
||||
'fields' => 'values.name,values.target.hash,next',
|
||||
'sort' => '-target.date'
|
||||
'sort' => '-target.date',
|
||||
),
|
||||
null,
|
||||
'&'
|
||||
|
@ -338,8 +339,8 @@ abstract class BitbucketDriver extends VcsDriver
|
|||
/**
|
||||
* Get the remote content.
|
||||
*
|
||||
* @param string $url The URL of content
|
||||
* @param bool $fetchingRepoData
|
||||
* @param string $url The URL of content
|
||||
* @param bool $fetchingRepoData
|
||||
*
|
||||
* @return mixed The result
|
||||
*/
|
||||
|
@ -389,13 +390,13 @@ abstract class BitbucketDriver extends VcsDriver
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
* @param string $url
|
||||
* @return void
|
||||
*/
|
||||
abstract protected function setupFallbackDriver($url);
|
||||
|
||||
/**
|
||||
* @param array $cloneLinks
|
||||
* @param array $cloneLinks
|
||||
* @return void
|
||||
*/
|
||||
protected function parseCloneUrls(array $cloneLinks)
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
namespace Composer\Repository\Vcs;
|
||||
|
||||
use Composer\Config;
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\IO\IOInterface;
|
||||
|
@ -142,6 +141,7 @@ class FossilDriver extends VcsDriver
|
|||
public function getChangeDate($identifier)
|
||||
{
|
||||
$this->process->execute(sprintf('fossil finfo composer.json | head -n 2 | tail -n 1 | awk \'{print $1}\''), $output, $this->checkoutDir);
|
||||
|
||||
return new \DateTime(trim($output), new \DateTimeZone('UTC'));
|
||||
}
|
||||
|
||||
|
@ -194,8 +194,7 @@ class FossilDriver extends VcsDriver
|
|||
return true;
|
||||
}
|
||||
|
||||
if (preg_match('!/fossil/|\.fossil!', $url))
|
||||
{
|
||||
if (preg_match('!/fossil/|\.fossil!', $url)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -214,5 +213,5 @@ class FossilDriver extends VcsDriver
|
|||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace Composer\Repository\Vcs;
|
||||
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\Util\Git as GitUtil;
|
||||
|
@ -143,6 +142,7 @@ class GitDriver extends VcsDriver
|
|||
'git log -1 --format=%%at %s',
|
||||
ProcessExecutor::escape($identifier)
|
||||
), $output, $this->repoDir);
|
||||
|
||||
return new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
|
||||
}
|
||||
|
||||
|
|
|
@ -186,7 +186,6 @@ class GitHubDriver extends VcsDriver
|
|||
$notFoundRetries = 2;
|
||||
while ($notFoundRetries) {
|
||||
try {
|
||||
|
||||
$resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
|
||||
$resource = JsonFile::parseJson($this->getContents($resource));
|
||||
if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
|
||||
|
@ -202,6 +201,7 @@ class GitHubDriver extends VcsDriver
|
|||
// TODO should be removed when possible
|
||||
// retry fetching if github returns a 404 since they happen randomly
|
||||
$notFoundRetries--;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -220,6 +220,7 @@ class GitHubDriver extends VcsDriver
|
|||
|
||||
$resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
|
||||
$commit = JsonFile::parseJson($this->getContents($resource), $resource);
|
||||
|
||||
return new \DateTime($commit['commit']['committer']['date']);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,6 +127,7 @@ class GitLabDriver extends VcsDriver
|
|||
if ($e->getCode() !== 404) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -149,7 +150,6 @@ class GitLabDriver extends VcsDriver
|
|||
return new \DateTime();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -247,7 +247,7 @@ class GitLabDriver extends VcsDriver
|
|||
/**
|
||||
* Urlencode all non alphanumeric characters. rawurlencode() can not be used as it does not encode `.`
|
||||
*
|
||||
* @param string $string
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
private function urlEncodeAll($string)
|
||||
|
@ -260,6 +260,7 @@ class GitLabDriver extends VcsDriver
|
|||
}
|
||||
$encoded .= $character;
|
||||
}
|
||||
|
||||
return $encoded;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
namespace Composer\Repository\Vcs;
|
||||
|
||||
use Composer\Config;
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\IO\IOInterface;
|
||||
|
@ -142,6 +141,7 @@ class HgDriver extends VcsDriver
|
|||
$output,
|
||||
$this->repoDir
|
||||
);
|
||||
|
||||
return new \DateTime(trim($output), new \DateTimeZone('UTC'));
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ class PerforceDriver extends VcsDriver
|
|||
protected $branch;
|
||||
/** @var Perforce */
|
||||
protected $perforce;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -57,7 +58,6 @@ class PerforceDriver extends VcsDriver
|
|||
$this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -116,10 +116,10 @@ class PerforceDriver extends VcsDriver
|
|||
public function getSource($identifier)
|
||||
{
|
||||
$source = array(
|
||||
'type' => 'perforce',
|
||||
'url' => $this->repoConfig['url'],
|
||||
'type' => 'perforce',
|
||||
'url' => $this->repoConfig['url'],
|
||||
'reference' => $identifier,
|
||||
'p4user' => $this->perforce->getUser(),
|
||||
'p4user' => $this->perforce->getUser(),
|
||||
);
|
||||
|
||||
return $source;
|
||||
|
|
|
@ -37,10 +37,10 @@ class SvnDriver extends VcsDriver
|
|||
protected $rootIdentifier;
|
||||
protected $infoCache = array();
|
||||
|
||||
protected $trunkPath = 'trunk';
|
||||
protected $trunkPath = 'trunk';
|
||||
protected $branchesPath = 'branches';
|
||||
protected $tagsPath = 'tags';
|
||||
protected $packagePath = '';
|
||||
protected $tagsPath = 'tags';
|
||||
protected $packagePath = '';
|
||||
protected $cacheCredentials = true;
|
||||
|
||||
/**
|
||||
|
@ -132,7 +132,6 @@ class SvnDriver extends VcsDriver
|
|||
$this->infoCache[$identifier] = $composer;
|
||||
}
|
||||
|
||||
|
||||
return $this->infoCache[$identifier];
|
||||
}
|
||||
|
||||
|
|
|
@ -75,8 +75,8 @@ abstract class VcsDriver implements VcsDriverInterface
|
|||
/**
|
||||
* Returns whether or not the given $identifier should be cached or not.
|
||||
*
|
||||
* @param string $identifier
|
||||
* @return boolean
|
||||
* @param string $identifier
|
||||
* @return bool
|
||||
*/
|
||||
protected function shouldCache($identifier)
|
||||
{
|
||||
|
@ -102,7 +102,6 @@ abstract class VcsDriver implements VcsDriverInterface
|
|||
$this->infoCache[$identifier] = $composer;
|
||||
}
|
||||
|
||||
|
||||
return $this->infoCache[$identifier];
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,8 @@ interface VcsDriverInterface
|
|||
/**
|
||||
* Return the content of $file or null if the file does not exist.
|
||||
*
|
||||
* @param string $file
|
||||
* @param string $identifier
|
||||
* @param string $file
|
||||
* @param string $identifier
|
||||
* @return string
|
||||
*/
|
||||
public function getFileContent($file, $identifier);
|
||||
|
@ -45,7 +45,7 @@ interface VcsDriverInterface
|
|||
/**
|
||||
* Get the changedate for $identifier.
|
||||
*
|
||||
* @param string $identifier
|
||||
* @param string $identifier
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getChangeDate($identifier);
|
||||
|
|
|
@ -46,16 +46,16 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
|
|||
{
|
||||
parent::__construct();
|
||||
$this->drivers = $drivers ?: array(
|
||||
'github' => 'Composer\Repository\Vcs\GitHubDriver',
|
||||
'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
|
||||
'github' => 'Composer\Repository\Vcs\GitHubDriver',
|
||||
'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
|
||||
'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
|
||||
'git' => 'Composer\Repository\Vcs\GitDriver',
|
||||
'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
|
||||
'hg' => 'Composer\Repository\Vcs\HgDriver',
|
||||
'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
|
||||
'fossil' => 'Composer\Repository\Vcs\FossilDriver',
|
||||
'git' => 'Composer\Repository\Vcs\GitDriver',
|
||||
'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
|
||||
'hg' => 'Composer\Repository\Vcs\HgDriver',
|
||||
'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
|
||||
'fossil' => 'Composer\Repository\Vcs\FossilDriver',
|
||||
// svn must be last because identifying a subversion server for sure is practically impossible
|
||||
'svn' => 'Composer\Repository\Vcs\SvnDriver',
|
||||
'svn' => 'Composer\Repository\Vcs\SvnDriver',
|
||||
);
|
||||
|
||||
$this->url = $repoConfig['url'];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue