mirror of
https://github.com/composer/composer
synced 2025-05-10 17:12:51 +00:00
php-cs-fixer magic
This commit is contained in:
parent
4ea9b33a6c
commit
1bd4ccbd54
90 changed files with 396 additions and 400 deletions
|
@ -117,7 +117,7 @@ class ArrayRepository implements RepositoryInterface
|
|||
/**
|
||||
* Removes package from repository.
|
||||
*
|
||||
* @param PackageInterface $package package instance
|
||||
* @param PackageInterface $package package instance
|
||||
*/
|
||||
public function removePackage(PackageInterface $package)
|
||||
{
|
||||
|
@ -140,6 +140,7 @@ class ArrayRepository implements RepositoryInterface
|
|||
if (null === $this->packages) {
|
||||
$this->initialize();
|
||||
}
|
||||
|
||||
return $this->packages;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
namespace Composer\Repository;
|
||||
|
||||
use Composer\Package\Loader\ArrayLoader;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Cache;
|
||||
|
|
|
@ -57,6 +57,7 @@ class CompositeRepository implements RepositoryInterface
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -72,6 +73,7 @@ class CompositeRepository implements RepositoryInterface
|
|||
return $package;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -85,6 +87,7 @@ class CompositeRepository implements RepositoryInterface
|
|||
/* @var $repository RepositoryInterface */
|
||||
$packages[] = $repository->findPackages($name, $version);
|
||||
}
|
||||
|
||||
return call_user_func_array('array_merge', $packages);
|
||||
}
|
||||
|
||||
|
@ -98,6 +101,7 @@ class CompositeRepository implements RepositoryInterface
|
|||
/* @var $repository RepositoryInterface */
|
||||
$packages[] = $repository->getPackages();
|
||||
}
|
||||
|
||||
return call_user_func_array('array_merge', $packages);
|
||||
}
|
||||
|
||||
|
@ -111,6 +115,7 @@ class CompositeRepository implements RepositoryInterface
|
|||
/* @var $repository RepositoryInterface */
|
||||
$total += $repository->count();
|
||||
}
|
||||
|
||||
return $total;
|
||||
}
|
||||
|
||||
|
@ -122,4 +127,4 @@ class CompositeRepository implements RepositoryInterface
|
|||
{
|
||||
$this->repositories[] = $repository;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
namespace Composer\Repository;
|
||||
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Package\Loader\ArrayLoader;
|
||||
use Composer\Package\Dumper\ArrayDumper;
|
||||
|
@ -31,7 +30,7 @@ class FilesystemRepository extends ArrayRepository implements WritableRepository
|
|||
/**
|
||||
* Initializes filesystem repository.
|
||||
*
|
||||
* @param JsonFile $repositoryFile repository json file
|
||||
* @param JsonFile $repositoryFile repository json file
|
||||
*/
|
||||
public function __construct(JsonFile $repositoryFile)
|
||||
{
|
||||
|
|
|
@ -12,10 +12,6 @@
|
|||
|
||||
namespace Composer\Repository;
|
||||
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\Loader\ArrayLoader;
|
||||
use Composer\Package\Dumper\ArrayDumper;
|
||||
|
||||
/**
|
||||
* Installed array repository.
|
||||
|
|
|
@ -12,10 +12,6 @@
|
|||
|
||||
namespace Composer\Repository;
|
||||
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\Loader\ArrayLoader;
|
||||
use Composer\Package\Dumper\ArrayDumper;
|
||||
|
||||
/**
|
||||
* Installed filesystem repository.
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace Composer\Repository;
|
||||
|
||||
use Composer\Package\PackageInterface;
|
||||
|
||||
/**
|
||||
* Installable repository interface.
|
||||
|
|
|
@ -12,10 +12,7 @@
|
|||
|
||||
namespace Composer\Repository;
|
||||
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\Loader\ArrayLoader;
|
||||
use Composer\Package\Dumper\ArrayDumper;
|
||||
|
||||
/**
|
||||
* Package repository.
|
||||
|
|
|
@ -124,9 +124,9 @@ class PearRepository extends ArrayRepository
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $categoryLink
|
||||
* @throws TransportException
|
||||
* @throws \InvalidArgumentException
|
||||
* @param string $categoryLink
|
||||
* @throws TransportException
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
private function fetchPearPackages($categoryLink)
|
||||
{
|
||||
|
@ -192,8 +192,8 @@ class PearRepository extends ArrayRepository
|
|||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @return string
|
||||
* @param array $data
|
||||
* @return string
|
||||
*/
|
||||
private function parseVersion(array $data)
|
||||
{
|
||||
|
@ -207,13 +207,14 @@ class PearRepository extends ArrayRepository
|
|||
if (isset($data['max'])) {
|
||||
$versions[] = '<=' . $data['max'];
|
||||
}
|
||||
|
||||
return implode(',', $versions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Improve dependencies resolution of pear packages.
|
||||
* @param array $depsOptions
|
||||
* @return array
|
||||
* @param array $depsOptions
|
||||
* @return array
|
||||
*/
|
||||
private function parseDependenciesOptions(array $depsOptions)
|
||||
{
|
||||
|
@ -251,13 +252,14 @@ class PearRepository extends ArrayRepository
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $deps
|
||||
* @return array
|
||||
* @throws \InvalidArgumentException
|
||||
* @param string $deps
|
||||
* @return array
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
private function parseDependencies($deps)
|
||||
{
|
||||
|
@ -282,9 +284,9 @@ class PearRepository extends ArrayRepository
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $packagesLink
|
||||
* @return void
|
||||
* @throws \InvalidArgumentException
|
||||
* @param string $packagesLink
|
||||
* @return void
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
private function fetchPear2Packages($packagesLink)
|
||||
{
|
||||
|
@ -357,7 +359,7 @@ class PearRepository extends ArrayRepository
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
* @param string $url
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
private function requestXml($url)
|
||||
|
|
|
@ -25,36 +25,36 @@ interface RepositoryInterface extends \Countable
|
|||
/**
|
||||
* Checks if specified package registered (installed).
|
||||
*
|
||||
* @param PackageInterface $package package instance
|
||||
* @param PackageInterface $package package instance
|
||||
*
|
||||
* @return Boolean
|
||||
* @return Boolean
|
||||
*/
|
||||
function hasPackage(PackageInterface $package);
|
||||
|
||||
/**
|
||||
* Searches for the first match of a package by name and version.
|
||||
*
|
||||
* @param string $name package name
|
||||
* @param string $version package version
|
||||
* @param string $name package name
|
||||
* @param string $version package version
|
||||
*
|
||||
* @return PackageInterface|null
|
||||
* @return PackageInterface|null
|
||||
*/
|
||||
function findPackage($name, $version);
|
||||
|
||||
/**
|
||||
* Searches for all packages matching a name and optionally a version.
|
||||
*
|
||||
* @param string $name package name
|
||||
* @param string $version package version
|
||||
* @param string $name package name
|
||||
* @param string $version package version
|
||||
*
|
||||
* @return array
|
||||
* @return array
|
||||
*/
|
||||
function findPackages($name, $version = null);
|
||||
|
||||
/**
|
||||
* Returns list of registered packages.
|
||||
*
|
||||
* @return array
|
||||
* @return array
|
||||
*/
|
||||
function getPackages();
|
||||
}
|
||||
|
|
|
@ -40,10 +40,10 @@ class RepositoryManager
|
|||
/**
|
||||
* Searches for a package by it's name and version in managed repositories.
|
||||
*
|
||||
* @param string $name package name
|
||||
* @param string $version package version
|
||||
* @param string $name package name
|
||||
* @param string $version package version
|
||||
*
|
||||
* @return PackageInterface|null
|
||||
* @return PackageInterface|null
|
||||
*/
|
||||
public function findPackage($name, $version)
|
||||
{
|
||||
|
@ -57,10 +57,10 @@ class RepositoryManager
|
|||
/**
|
||||
* Searches for all packages matching a name and optionally a version in managed repositories.
|
||||
*
|
||||
* @param string $name package name
|
||||
* @param string $version package version
|
||||
* @param string $name package name
|
||||
* @param string $version package version
|
||||
*
|
||||
* @return array
|
||||
* @return array
|
||||
*/
|
||||
public function findPackages($name, $version)
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ class RepositoryManager
|
|||
/**
|
||||
* Adds repository
|
||||
*
|
||||
* @param RepositoryInterface $repository repository instance
|
||||
* @param RepositoryInterface $repository repository instance
|
||||
*/
|
||||
public function addRepository(RepositoryInterface $repository)
|
||||
{
|
||||
|
@ -86,10 +86,10 @@ class RepositoryManager
|
|||
/**
|
||||
* Returns a new repository for a specific installation type.
|
||||
*
|
||||
* @param string $type repository type
|
||||
* @param string $config repository configuration
|
||||
* @return RepositoryInterface
|
||||
* @throws InvalidArgumentException if repository for provided type is not registeterd
|
||||
* @param string $type repository type
|
||||
* @param string $config repository configuration
|
||||
* @return RepositoryInterface
|
||||
* @throws InvalidArgumentException if repository for provided type is not registeterd
|
||||
*/
|
||||
public function createRepository($type, $config)
|
||||
{
|
||||
|
@ -98,14 +98,15 @@ class RepositoryManager
|
|||
}
|
||||
|
||||
$class = $this->repositoryClasses[$type];
|
||||
|
||||
return new $class($config, $this->io, $this->config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores repository class for a specific installation type.
|
||||
*
|
||||
* @param string $type installation type
|
||||
* @param string $class class name of the repo implementation
|
||||
* @param string $type installation type
|
||||
* @param string $class class name of the repo implementation
|
||||
*/
|
||||
public function setRepositoryClass($type, $class)
|
||||
{
|
||||
|
@ -115,7 +116,7 @@ class RepositoryManager
|
|||
/**
|
||||
* Returns all repositories, except local one.
|
||||
*
|
||||
* @return array
|
||||
* @return array
|
||||
*/
|
||||
public function getRepositories()
|
||||
{
|
||||
|
@ -125,7 +126,7 @@ class RepositoryManager
|
|||
/**
|
||||
* Sets local repository for the project.
|
||||
*
|
||||
* @param RepositoryInterface $repository repository instance
|
||||
* @param RepositoryInterface $repository repository instance
|
||||
*/
|
||||
public function setLocalRepository(RepositoryInterface $repository)
|
||||
{
|
||||
|
@ -135,7 +136,7 @@ class RepositoryManager
|
|||
/**
|
||||
* Returns local repository for the project.
|
||||
*
|
||||
* @return RepositoryInterface
|
||||
* @return RepositoryInterface
|
||||
*/
|
||||
public function getLocalRepository()
|
||||
{
|
||||
|
@ -145,7 +146,7 @@ class RepositoryManager
|
|||
/**
|
||||
* Sets localDev repository for the project.
|
||||
*
|
||||
* @param RepositoryInterface $repository repository instance
|
||||
* @param RepositoryInterface $repository repository instance
|
||||
*/
|
||||
public function setLocalDevRepository(RepositoryInterface $repository)
|
||||
{
|
||||
|
@ -155,7 +156,7 @@ class RepositoryManager
|
|||
/**
|
||||
* Returns localDev repository for the project.
|
||||
*
|
||||
* @return RepositoryInterface
|
||||
* @return RepositoryInterface
|
||||
*/
|
||||
public function getLocalDevRepository()
|
||||
{
|
||||
|
@ -165,7 +166,7 @@ class RepositoryManager
|
|||
/**
|
||||
* Returns all local repositories for the project.
|
||||
*
|
||||
* @return array[RepositoryInterface]
|
||||
* @return array[RepositoryInterface]
|
||||
*/
|
||||
public function getLocalRepositories()
|
||||
{
|
||||
|
|
|
@ -148,6 +148,7 @@ class GitBitbucketDriver extends VcsDriver implements VcsDriverInterface
|
|||
if ($io->isVerbose()) {
|
||||
$io->write('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ use Composer\Downloader\TransportException;
|
|||
use Composer\Json\JsonFile;
|
||||
use Composer\Cache;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Composer\Util\RemoteFilesystem;
|
||||
|
||||
/**
|
||||
|
@ -62,6 +61,7 @@ class GitHubDriver extends VcsDriver
|
|||
if ($this->gitDriver) {
|
||||
return $this->gitDriver->getRootIdentifier();
|
||||
}
|
||||
|
||||
return $this->rootIdentifier;
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,7 @@ class GitHubDriver extends VcsDriver
|
|||
if ($this->gitDriver) {
|
||||
return $this->gitDriver->getUrl();
|
||||
}
|
||||
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
|
@ -206,6 +207,7 @@ class GitHubDriver extends VcsDriver
|
|||
if ($io->isVerbose()) {
|
||||
$io->write('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -245,7 +247,7 @@ class GitHubDriver extends VcsDriver
|
|||
$this->rootIdentifier = 'master';
|
||||
}
|
||||
} catch (TransportException $e) {
|
||||
switch($e->getCode()) {
|
||||
switch ($e->getCode()) {
|
||||
case 401:
|
||||
case 404:
|
||||
$this->isPrivate = true;
|
||||
|
@ -262,6 +264,7 @@ class GitHubDriver extends VcsDriver
|
|||
$this->remoteFilesystem
|
||||
);
|
||||
$this->gitDriver->initialize();
|
||||
|
||||
return;
|
||||
}
|
||||
$this->io->write('Authentication required (<info>'.$this->url.'</info>):');
|
||||
|
|
|
@ -148,6 +148,7 @@ class HgBitbucketDriver extends VcsDriver
|
|||
if ($io->isVerbose()) {
|
||||
$io->write('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -171,6 +171,7 @@ class HgDriver extends VcsDriver
|
|||
|
||||
$processExecutor = new ProcessExecutor();
|
||||
$exit = $processExecutor->execute(sprintf('cd %s && hg identify %s', escapeshellarg(sys_get_temp_dir()), escapeshellarg($url)), $ignored);
|
||||
|
||||
return $exit === 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,11 +35,11 @@ abstract class VcsDriver implements VcsDriverInterface
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $url The URL
|
||||
* @param IOInterface $io The IO instance
|
||||
* @param Config $config The composer configuration
|
||||
* @param ProcessExecutor $process Process instance, injectable for mocking
|
||||
* @param callable $remoteFilesystem Remote Filesystem, injectable for mocking
|
||||
* @param string $url The URL
|
||||
* @param IOInterface $io The IO instance
|
||||
* @param Config $config The composer configuration
|
||||
* @param ProcessExecutor $process Process instance, injectable for mocking
|
||||
* @param callable $remoteFilesystem Remote Filesystem, injectable for mocking
|
||||
*/
|
||||
final public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null, $remoteFilesystem = null)
|
||||
{
|
||||
|
@ -76,6 +76,7 @@ abstract class VcsDriver implements VcsDriverInterface
|
|||
if (extension_loaded('openssl')) {
|
||||
return 'https';
|
||||
}
|
||||
|
||||
return 'http';
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ interface VcsDriverInterface
|
|||
/**
|
||||
* Return the composer.json file information
|
||||
*
|
||||
* @param string $identifier Any identifier to a specific branch/tag/commit
|
||||
* @return array containing all infos from the composer.json file
|
||||
* @param string $identifier Any identifier to a specific branch/tag/commit
|
||||
* @return array containing all infos from the composer.json file
|
||||
*/
|
||||
function getComposerInformation($identifier);
|
||||
|
||||
|
@ -54,14 +54,14 @@ interface VcsDriverInterface
|
|||
function getTags();
|
||||
|
||||
/**
|
||||
* @param string $identifier Any identifier to a specific branch/tag/commit
|
||||
* @return array With type, url reference and shasum keys.
|
||||
* @param string $identifier Any identifier to a specific branch/tag/commit
|
||||
* @return array With type, url reference and shasum keys.
|
||||
*/
|
||||
function getDist($identifier);
|
||||
|
||||
/**
|
||||
* @param string $identifier Any identifier to a specific branch/tag/commit
|
||||
* @return array With type, url and reference keys.
|
||||
* @param string $identifier Any identifier to a specific branch/tag/commit
|
||||
* @return array With type, url and reference keys.
|
||||
*/
|
||||
function getSource($identifier);
|
||||
|
||||
|
@ -76,7 +76,7 @@ interface VcsDriverInterface
|
|||
* Return true if the repository has a composer file for a given identifier,
|
||||
* false otherwise.
|
||||
*
|
||||
* @param string $identifier Any identifier to a specific branch/tag/commit
|
||||
* @param string $identifier Any identifier to a specific branch/tag/commit
|
||||
* @return boolean Whether the repository has a composer file for a given identifier.
|
||||
*/
|
||||
function hasComposerFile($identifier);
|
||||
|
@ -84,9 +84,9 @@ interface VcsDriverInterface
|
|||
/**
|
||||
* Checks if this driver can handle a given url
|
||||
*
|
||||
* @param IOInterface $io IO instance
|
||||
* @param string $url
|
||||
* @param Boolean $shallow unless true, only shallow checks (url matching typically) should be done
|
||||
* @param IOInterface $io IO instance
|
||||
* @param string $url
|
||||
* @param Boolean $shallow unless true, only shallow checks (url matching typically) should be done
|
||||
* @return Boolean
|
||||
*/
|
||||
static function supports(IOInterface $io, $url, $deep = false);
|
||||
|
|
|
@ -15,8 +15,6 @@ namespace Composer\Repository;
|
|||
use Composer\Downloader\TransportException;
|
||||
use Composer\Repository\Vcs\VcsDriverInterface;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Package\Loader\ArrayLoader;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Config;
|
||||
|
@ -58,6 +56,7 @@ class VcsRepository extends ArrayRepository
|
|||
$class = $this->drivers[$this->type];
|
||||
$driver = new $class($this->url, $this->io, $this->config);
|
||||
$driver->initialize();
|
||||
|
||||
return $driver;
|
||||
}
|
||||
|
||||
|
@ -65,6 +64,7 @@ class VcsRepository extends ArrayRepository
|
|||
if ($driver::supports($this->io, $this->url)) {
|
||||
$driver = new $driver($this->url, $this->io, $this->config);
|
||||
$driver->initialize();
|
||||
|
||||
return $driver;
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +73,7 @@ class VcsRepository extends ArrayRepository
|
|||
if ($driver::supports($this->io, $this->url, true)) {
|
||||
$driver = new $driver($this->url, $this->io, $this->config);
|
||||
$driver->initialize();
|
||||
|
||||
return $driver;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,14 +29,14 @@ interface WritableRepositoryInterface extends RepositoryInterface
|
|||
/**
|
||||
* Adds package to the repository.
|
||||
*
|
||||
* @param PackageInterface $package package instance
|
||||
* @param PackageInterface $package package instance
|
||||
*/
|
||||
function addPackage(PackageInterface $package);
|
||||
|
||||
/**
|
||||
* Removes package from the repository.
|
||||
*
|
||||
* @param PackageInterface $package package instance
|
||||
* @param PackageInterface $package package instance
|
||||
*/
|
||||
function removePackage(PackageInterface $package);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue