php-cs-fixer magic
parent
4ea9b33a6c
commit
1bd4ccbd54
|
@ -13,9 +13,7 @@
|
|||
namespace Composer\Autoload;
|
||||
|
||||
use Composer\Installer\InstallationManager;
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Package\Loader\JsonLoader;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Repository\RepositoryInterface;
|
||||
use Composer\Util\Filesystem;
|
||||
|
@ -104,6 +102,7 @@ EOF;
|
|||
return false;
|
||||
}
|
||||
require_once \$path;
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@ -169,7 +168,7 @@ EOF;
|
|||
/**
|
||||
* Compiles an ordered list of namespace => path mappings
|
||||
*
|
||||
* @param array $packageMap array of array(package, installDir-relative-to-composer.json)
|
||||
* @param array $packageMap array of array(package, installDir-relative-to-composer.json)
|
||||
* @return array array('psr-0' => array('Ns\\Foo' => array('installDir')))
|
||||
*/
|
||||
public function parseAutoloads(array $packageMap)
|
||||
|
@ -205,7 +204,7 @@ EOF;
|
|||
/**
|
||||
* Registers an autoloader based on an autoload map returned by parseAutoloads
|
||||
*
|
||||
* @param array $autoloads see parseAutoloads return value
|
||||
* @param array $autoloads see parseAutoloads return value
|
||||
* @return ClassLoader
|
||||
*/
|
||||
public function createLoader(array $autoloads)
|
||||
|
@ -278,6 +277,7 @@ EOF;
|
|||
$path = substr($path, strlen($vendorPath));
|
||||
$baseDir = '$vendorDir . ';
|
||||
}
|
||||
|
||||
return $baseDir.var_export($path, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -77,8 +77,8 @@ class ClassLoader
|
|||
/**
|
||||
* Registers a set of classes
|
||||
*
|
||||
* @param string $prefix The classes prefix
|
||||
* @param array|string $paths The location(s) of the classes
|
||||
* @param string $prefix The classes prefix
|
||||
* @param array|string $paths The location(s) of the classes
|
||||
*/
|
||||
public function add($prefix, $paths)
|
||||
{
|
||||
|
@ -86,6 +86,7 @@ class ClassLoader
|
|||
foreach ((array) $paths as $path) {
|
||||
$this->fallbackDirs[] = $path;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (isset($this->prefixes[$prefix])) {
|
||||
|
@ -140,13 +141,14 @@ class ClassLoader
|
|||
/**
|
||||
* Loads the given class or interface.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
* @param string $class The name of the class
|
||||
* @return Boolean|null True, if loaded
|
||||
*/
|
||||
public function loadClass($class)
|
||||
{
|
||||
if ($file = $this->findFile($class)) {
|
||||
require $file;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class ClassMapGenerator
|
|||
* Generate a class map file
|
||||
*
|
||||
* @param Traversable $dirs Directories or a single path to search in
|
||||
* @param string $file The name of the class map file
|
||||
* @param string $file The name of the class map file
|
||||
*/
|
||||
static public function dump($dirs, $file)
|
||||
{
|
||||
|
|
|
@ -135,6 +135,7 @@ EOT
|
|||
protected function createDownloadManager(IOInterface $io)
|
||||
{
|
||||
$factory = new Factory();
|
||||
|
||||
return $factory->createDownloadManager($io);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
namespace Composer\Command;
|
||||
|
||||
use Composer\Composer;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
@ -64,9 +63,9 @@ EOT
|
|||
/**
|
||||
* finds a list of packages which depend on another package
|
||||
*
|
||||
* @param InputInterface $input
|
||||
* @param OutputInterface $output
|
||||
* @param Composer $composer
|
||||
* @param InputInterface $input
|
||||
* @param OutputInterface $output
|
||||
* @param Composer $composer
|
||||
* @return array
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
|
@ -117,4 +116,4 @@ EOT
|
|||
$output->writeln($package);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
namespace Composer\Command\Helper;
|
||||
|
||||
use Symfony\Component\Console\Helper\DialogHelper as BaseDialogHelper;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class DialogHelper extends BaseDialogHelper
|
||||
{
|
||||
|
@ -23,8 +22,8 @@ class DialogHelper extends BaseDialogHelper
|
|||
* "Do you want to continue [yes]:"
|
||||
*
|
||||
* @param string $question The question you want to ask
|
||||
* @param mixed $default Default value to add to message, if false no default will be shown
|
||||
* @param string $sep Separation char for between message and user input
|
||||
* @param mixed $default Default value to add to message, if false no default will be shown
|
||||
* @param string $sep Separation char for between message and user input
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -34,4 +33,4 @@ class DialogHelper extends BaseDialogHelper
|
|||
sprintf('<info>%s</info> [<comment>%s</comment>]%s ', $question, $default, $sep) :
|
||||
sprintf('<info>%s</info>%s ', $question, $sep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -333,6 +333,7 @@ EOT
|
|||
foreach ($matches as $match) {
|
||||
$this->gitConfig[$match[1]] = $match[2];
|
||||
}
|
||||
|
||||
return $this->gitConfig;
|
||||
}
|
||||
|
||||
|
@ -389,4 +390,4 @@ EOT
|
|||
|
||||
file_put_contents($ignoreFile, $contents . $vendor. "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,8 +118,8 @@ EOT
|
|||
/**
|
||||
* tries to find a token within the name/keywords/description
|
||||
*
|
||||
* @param PackageInterface $package
|
||||
* @param string $token
|
||||
* @param PackageInterface $package
|
||||
* @param string $token
|
||||
* @return boolean
|
||||
*/
|
||||
private function matchPackage(PackageInterface $package, $token)
|
||||
|
|
|
@ -89,6 +89,7 @@ EOT
|
|||
$this->printLinks($input, $output, $package, 'provides');
|
||||
$this->printLinks($input, $output, $package, 'conflicts');
|
||||
$this->printLinks($input, $output, $package, 'replaces');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -125,7 +126,7 @@ EOT
|
|||
/**
|
||||
* finds a package by name and version if provided
|
||||
*
|
||||
* @param InputInterface $input
|
||||
* @param InputInterface $input
|
||||
* @return PackageInterface
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
|
@ -192,6 +193,7 @@ EOT
|
|||
{
|
||||
if ($input->getArgument('version')) {
|
||||
$output->writeln('<info>version</info> : ' . $package->getPrettyVersion());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ EOT
|
|||
}
|
||||
|
||||
/**
|
||||
* @param InputInterface $input
|
||||
* @param InputInterface $input
|
||||
* @param OutputInterface $output
|
||||
*
|
||||
* @return int
|
||||
|
|
|
@ -27,7 +27,7 @@ class Compiler
|
|||
* Compiles composer into a single phar file
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
* @param string $pharFile The full path to the file to create
|
||||
* @param string $pharFile The full path to the file to create
|
||||
*/
|
||||
public function compile($pharFile = 'composer.phar')
|
||||
{
|
||||
|
@ -135,7 +135,7 @@ class Compiler
|
|||
/**
|
||||
* Removes whitespace from a PHP source string while preserving line numbers.
|
||||
*
|
||||
* @param string $source A PHP string
|
||||
* @param string $source A PHP string
|
||||
* @return string The PHP string with the whitespace removed
|
||||
*/
|
||||
private function stripWhitespace($source)
|
||||
|
|
|
@ -46,7 +46,7 @@ class Config
|
|||
/**
|
||||
* Returns a setting
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($key)
|
||||
|
@ -57,6 +57,7 @@ class Config
|
|||
case 'process-timeout':
|
||||
// convert foo-bar to COMPOSER_FOO_BAR and check if it exists since it overrides the local config
|
||||
$env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
|
||||
|
||||
return $this->process(getenv($env) ?: $this->config[$key]);
|
||||
|
||||
case 'home':
|
||||
|
@ -70,7 +71,7 @@ class Config
|
|||
/**
|
||||
* Checks whether a setting exists
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $key
|
||||
* @return Boolean
|
||||
*/
|
||||
public function has($key)
|
||||
|
@ -87,6 +88,7 @@ class Config
|
|||
private function process($value)
|
||||
{
|
||||
$config = $this;
|
||||
|
||||
return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config) {
|
||||
return $config->get($match[1]);
|
||||
}, $value);
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace Composer\DependencyResolver;
|
||||
|
||||
use Composer\Repository\RepositoryInterface;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
|
@ -179,7 +178,7 @@ class DefaultPolicy implements PolicyInterface
|
|||
if ($this->versionCompare($package, $bestPackage, '>')) {
|
||||
$bestPackage = $package;
|
||||
$bestLiterals = array($literal);
|
||||
} else if ($this->versionCompare($package, $bestPackage, '==')) {
|
||||
} elseif ($this->versionCompare($package, $bestPackage, '==')) {
|
||||
$bestLiterals[] = $literal;
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +198,7 @@ class DefaultPolicy implements PolicyInterface
|
|||
if ($this->versionCompare($literal->getPackage(), $maxPackage, '>')) {
|
||||
$maxPackage = $literal->getPackage();
|
||||
$maxLiterals = array($literal);
|
||||
} else if ($this->versionCompare($literal->getPackage(), $maxPackage, '==')) {
|
||||
} elseif ($this->versionCompare($literal->getPackage(), $maxPackage, '==')) {
|
||||
$maxLiterals[] = $literal;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ class InstallOperation extends SolverOperation
|
|||
/**
|
||||
* Initializes operation.
|
||||
*
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $reason operation reason
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $reason operation reason
|
||||
*/
|
||||
public function __construct(PackageInterface $package, $reason = null)
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ class InstallOperation extends SolverOperation
|
|||
/**
|
||||
* Returns package instance.
|
||||
*
|
||||
* @return PackageInterface
|
||||
* @return PackageInterface
|
||||
*/
|
||||
public function getPackage()
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ class InstallOperation extends SolverOperation
|
|||
/**
|
||||
* Returns job type.
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public function getJobType()
|
||||
{
|
||||
|
|
|
@ -26,8 +26,8 @@ class MarkAliasInstalledOperation extends SolverOperation
|
|||
/**
|
||||
* Initializes operation.
|
||||
*
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $reason operation reason
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $reason operation reason
|
||||
*/
|
||||
public function __construct(AliasPackage $package, $reason = null)
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ class MarkAliasInstalledOperation extends SolverOperation
|
|||
/**
|
||||
* Returns package instance.
|
||||
*
|
||||
* @return PackageInterface
|
||||
* @return PackageInterface
|
||||
*/
|
||||
public function getPackage()
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ class MarkAliasInstalledOperation extends SolverOperation
|
|||
/**
|
||||
* Returns job type.
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public function getJobType()
|
||||
{
|
||||
|
|
|
@ -26,8 +26,8 @@ class MarkAliasUninstalledOperation extends SolverOperation
|
|||
/**
|
||||
* Initializes operation.
|
||||
*
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $reason operation reason
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $reason operation reason
|
||||
*/
|
||||
public function __construct(AliasPackage $package, $reason = null)
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ class MarkAliasUninstalledOperation extends SolverOperation
|
|||
/**
|
||||
* Returns package instance.
|
||||
*
|
||||
* @return PackageInterface
|
||||
* @return PackageInterface
|
||||
*/
|
||||
public function getPackage()
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ class MarkAliasUninstalledOperation extends SolverOperation
|
|||
/**
|
||||
* Returns job type.
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public function getJobType()
|
||||
{
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace Composer\DependencyResolver\Operation;
|
||||
|
||||
use Composer\Package\PackageInterface;
|
||||
|
||||
/**
|
||||
* Solver operation interface.
|
||||
|
@ -24,14 +23,14 @@ interface OperationInterface
|
|||
/**
|
||||
* Returns job type.
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
function getJobType();
|
||||
|
||||
/**
|
||||
* Returns operation reason.
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
function getReason();
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ abstract class SolverOperation implements OperationInterface
|
|||
/**
|
||||
* Initializes operation.
|
||||
*
|
||||
* @param string $reason operation reason
|
||||
* @param string $reason operation reason
|
||||
*/
|
||||
public function __construct($reason = null)
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ abstract class SolverOperation implements OperationInterface
|
|||
/**
|
||||
* Returns operation reason.
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public function getReason()
|
||||
{
|
||||
|
|
|
@ -26,8 +26,8 @@ class UninstallOperation extends SolverOperation
|
|||
/**
|
||||
* Initializes operation.
|
||||
*
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $reason operation reason
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $reason operation reason
|
||||
*/
|
||||
public function __construct(PackageInterface $package, $reason = null)
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ class UninstallOperation extends SolverOperation
|
|||
/**
|
||||
* Returns package instance.
|
||||
*
|
||||
* @return PackageInterface
|
||||
* @return PackageInterface
|
||||
*/
|
||||
public function getPackage()
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ class UninstallOperation extends SolverOperation
|
|||
/**
|
||||
* Returns job type.
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public function getJobType()
|
||||
{
|
||||
|
|
|
@ -27,9 +27,9 @@ class UpdateOperation extends SolverOperation
|
|||
/**
|
||||
* Initializes update operation.
|
||||
*
|
||||
* @param PackageInterface $initial initial package
|
||||
* @param PackageInterface $target target package (updated)
|
||||
* @param string $reason update reason
|
||||
* @param PackageInterface $initial initial package
|
||||
* @param PackageInterface $target target package (updated)
|
||||
* @param string $reason update reason
|
||||
*/
|
||||
public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ class UpdateOperation extends SolverOperation
|
|||
/**
|
||||
* Returns initial package.
|
||||
*
|
||||
* @return PackageInterface
|
||||
* @return PackageInterface
|
||||
*/
|
||||
public function getInitialPackage()
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ class UpdateOperation extends SolverOperation
|
|||
/**
|
||||
* Returns target package.
|
||||
*
|
||||
* @return PackageInterface
|
||||
* @return PackageInterface
|
||||
*/
|
||||
public function getTargetPackage()
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ class UpdateOperation extends SolverOperation
|
|||
/**
|
||||
* Returns job type.
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public function getJobType()
|
||||
{
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace Composer\DependencyResolver;
|
||||
|
||||
use Composer\Repository\RepositoryInterface;
|
||||
use Composer\Package\PackageInterface;
|
||||
|
||||
/**
|
||||
|
|
|
@ -127,7 +127,7 @@ class Pool
|
|||
* @param string $name The package name to be searched for
|
||||
* @param LinkConstraintInterface $constraint A constraint that all returned
|
||||
* packages must match or null to return all
|
||||
* @return array A set of packages
|
||||
* @return array A set of packages
|
||||
*/
|
||||
public function whatProvides($name, LinkConstraintInterface $constraint = null)
|
||||
{
|
||||
|
@ -155,6 +155,7 @@ class Pool
|
|||
public function literalToPackage($literal)
|
||||
{
|
||||
$packageId = abs($literal);
|
||||
|
||||
return $this->packageById($packageId);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class Problem
|
|||
/**
|
||||
* Add a rule as a reason
|
||||
*
|
||||
* @param Rule $rule A rule which is a reason for this problem
|
||||
* @param Rule $rule A rule which is a reason for this problem
|
||||
*/
|
||||
public function addRule(Rule $rule)
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ class Problem
|
|||
/**
|
||||
* Retrieve all reasons for this problem
|
||||
*
|
||||
* @return array The problem's reasons
|
||||
* @return array The problem's reasons
|
||||
*/
|
||||
public function getReasons()
|
||||
{
|
||||
|
@ -65,8 +65,10 @@ class Problem
|
|||
if (0 === stripos($job['packageName'], 'ext-')) {
|
||||
$ext = substr($job['packageName'], 4);
|
||||
$error = extension_loaded($ext) ? 'has the wrong version ('.phpversion($ext).') installed' : 'is missing from your system';
|
||||
|
||||
return 'The requested PHP extension "'.$job['packageName'].'" '.$this->constraintToText($job['constraint']).$error.'.';
|
||||
}
|
||||
|
||||
return 'The requested package "'.$job['packageName'].'" '.$this->constraintToText($job['constraint']).'could not be found.';
|
||||
}
|
||||
}
|
||||
|
@ -93,8 +95,8 @@ class Problem
|
|||
/**
|
||||
* Store a reason descriptor but ignore duplicates
|
||||
*
|
||||
* @param string $id A canonical identifier for the reason
|
||||
* @param string $reason The reason descriptor
|
||||
* @param string $id A canonical identifier for the reason
|
||||
* @param string $reason The reason descriptor
|
||||
*/
|
||||
protected function addReason($id, $reason)
|
||||
{
|
||||
|
@ -106,8 +108,8 @@ class Problem
|
|||
/**
|
||||
* Turns a job into a human readable description
|
||||
*
|
||||
* @param array $job
|
||||
* @return string
|
||||
* @param array $job
|
||||
* @return string
|
||||
*/
|
||||
protected function jobToText($job)
|
||||
{
|
||||
|
@ -126,8 +128,8 @@ class Problem
|
|||
/**
|
||||
* Turns a constraint into text usable in a sentence describing a job
|
||||
*
|
||||
* @param LinkConstraint $constraint
|
||||
* @return string
|
||||
* @param LinkConstraint $constraint
|
||||
* @return string
|
||||
*/
|
||||
protected function constraintToText($constraint)
|
||||
{
|
||||
|
|
|
@ -86,7 +86,7 @@ class Rule
|
|||
* Ignores whether either of the rules is disabled.
|
||||
*
|
||||
* @param Rule $rule The rule to check against
|
||||
* @return bool Whether the rules are equal
|
||||
* @return bool Whether the rules are equal
|
||||
*/
|
||||
public function equals(Rule $rule)
|
||||
{
|
||||
|
@ -170,6 +170,7 @@ class Rule
|
|||
case self::RULE_PACKAGE_CONFLICT:
|
||||
$package1 = $this->pool->literalToPackage($this->literals[0]);
|
||||
$package2 = $this->pool->literalToPackage($this->literals[1]);
|
||||
|
||||
return 'Package "'.$package1.'" conflicts with "'.$package2.'"';
|
||||
|
||||
case self::RULE_PACKAGE_REQUIRES:
|
||||
|
@ -188,6 +189,7 @@ class Rule
|
|||
} else {
|
||||
$text .= 'No package satisfies this dependency.';
|
||||
}
|
||||
|
||||
return $text;
|
||||
|
||||
case self::RULE_PACKAGE_OBSOLETES:
|
||||
|
|
|
@ -93,16 +93,14 @@ class RuleSet implements \IteratorAggregate, \Countable
|
|||
|
||||
public function getIteratorFor($types)
|
||||
{
|
||||
if (!is_array($types))
|
||||
{
|
||||
if (!is_array($types)) {
|
||||
$types = array($types);
|
||||
}
|
||||
|
||||
$allRules = $this->getRules();
|
||||
$rules = array();
|
||||
|
||||
foreach ($types as $type)
|
||||
{
|
||||
foreach ($types as $type) {
|
||||
$rules[$type] = $allRules[$type];
|
||||
}
|
||||
|
||||
|
@ -112,15 +110,13 @@ class RuleSet implements \IteratorAggregate, \Countable
|
|||
|
||||
public function getIteratorWithout($types)
|
||||
{
|
||||
if (!is_array($types))
|
||||
{
|
||||
if (!is_array($types)) {
|
||||
$types = array($types);
|
||||
}
|
||||
|
||||
$rules = $this->getRules();
|
||||
|
||||
foreach ($types as $type)
|
||||
{
|
||||
foreach ($types as $type) {
|
||||
unset($rules[$type]);
|
||||
}
|
||||
|
||||
|
@ -131,6 +127,7 @@ class RuleSet implements \IteratorAggregate, \Countable
|
|||
{
|
||||
$types = self::$types;
|
||||
unset($types[-1]);
|
||||
|
||||
return array_keys($types);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,10 +12,8 @@
|
|||
|
||||
namespace Composer\DependencyResolver;
|
||||
|
||||
use Composer\Repository\RepositoryInterface;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\DependencyResolver\Operation;
|
||||
|
||||
/**
|
||||
* @author Nils Adermann <naderman@naderman.de>
|
||||
|
@ -40,13 +38,13 @@ class RuleSetGenerator
|
|||
* This rule is of the form (-A|B|C), where B and C are the providers of
|
||||
* one requirement of the package A.
|
||||
*
|
||||
* @param PackageInterface $package The package with a requirement
|
||||
* @param array $providers The providers of the requirement
|
||||
* @param int $reason A RULE_* constant describing the
|
||||
* @param PackageInterface $package The package with a requirement
|
||||
* @param array $providers The providers of the requirement
|
||||
* @param int $reason A RULE_* constant describing the
|
||||
* reason for generating this rule
|
||||
* @param mixed $reasonData Any data, e.g. the requirement name,
|
||||
* @param mixed $reasonData Any data, e.g. the requirement name,
|
||||
* that goes with the reason
|
||||
* @return Rule The generated rule or null if tautological
|
||||
* @return Rule The generated rule or null if tautological
|
||||
*/
|
||||
protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
|
||||
{
|
||||
|
@ -69,11 +67,11 @@ class RuleSetGenerator
|
|||
* The rule is (A|B|C) with A, B and C different packages. If the given
|
||||
* set of packages is empty an impossible rule is generated.
|
||||
*
|
||||
* @param array $packages The set of packages to choose from
|
||||
* @param int $reason A RULE_* constant describing the reason for
|
||||
* @param array $packages The set of packages to choose from
|
||||
* @param int $reason A RULE_* constant describing the reason for
|
||||
* generating this rule
|
||||
* @param array $job The job this rule was created from
|
||||
* @return Rule The generated rule
|
||||
* @param array $job The job this rule was created from
|
||||
* @return Rule The generated rule
|
||||
*/
|
||||
protected function createInstallOneOfRule(array $packages, $reason, $job)
|
||||
{
|
||||
|
@ -90,11 +88,11 @@ class RuleSetGenerator
|
|||
*
|
||||
* The rule for a package A is (-A).
|
||||
*
|
||||
* @param PackageInterface $package The package to be removed
|
||||
* @param int $reason A RULE_* constant describing the
|
||||
* @param PackageInterface $package The package to be removed
|
||||
* @param int $reason A RULE_* constant describing the
|
||||
* reason for generating this rule
|
||||
* @param array $job The job this rule was created from
|
||||
* @return Rule The generated rule
|
||||
* @param array $job The job this rule was created from
|
||||
* @return Rule The generated rule
|
||||
*/
|
||||
protected function createRemoveRule(PackageInterface $package, $reason, $job)
|
||||
{
|
||||
|
@ -107,13 +105,13 @@ class RuleSetGenerator
|
|||
* The rule for conflicting packages A and B is (-A|-B). A is called the issuer
|
||||
* and B the provider.
|
||||
*
|
||||
* @param PackageInterface $issuer The package declaring the conflict
|
||||
* @param Package $provider The package causing the conflict
|
||||
* @param int $reason A RULE_* constant describing the
|
||||
* @param PackageInterface $issuer The package declaring the conflict
|
||||
* @param Package $provider The package causing the conflict
|
||||
* @param int $reason A RULE_* constant describing the
|
||||
* reason for generating this rule
|
||||
* @param mixed $reasonData Any data, e.g. the package name, that
|
||||
* @param mixed $reasonData Any data, e.g. the package name, that
|
||||
* goes with the reason
|
||||
* @return Rule The generated rule
|
||||
* @return Rule The generated rule
|
||||
*/
|
||||
protected function createConflictRule(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
|
||||
{
|
||||
|
@ -134,7 +132,8 @@ class RuleSetGenerator
|
|||
* @param int $type A TYPE_* constant defining the rule type
|
||||
* @param Rule $newRule The rule about to be added
|
||||
*/
|
||||
private function addRule($type, Rule $newRule = null) {
|
||||
private function addRule($type, Rule $newRule = null)
|
||||
{
|
||||
if ($this->rules->containsEqual($newRule)) {
|
||||
return;
|
||||
}
|
||||
|
@ -230,9 +229,9 @@ class RuleSetGenerator
|
|||
/**
|
||||
* Adds all rules for all update packages of a given package
|
||||
*
|
||||
* @param PackageInterface $package Rules for this package's updates are to
|
||||
* @param PackageInterface $package Rules for this package's updates are to
|
||||
* be added
|
||||
* @param bool $allowAll Whether downgrades are allowed
|
||||
* @param bool $allowAll Whether downgrades are allowed
|
||||
*/
|
||||
private function addRulesForUpdatePackages(PackageInterface $package)
|
||||
{
|
||||
|
|
|
@ -70,7 +70,7 @@ class RuleWatchGraph
|
|||
* B must now be decided true as well.
|
||||
*
|
||||
* @param int $decidedLiteral The literal which was decided (A in our example)
|
||||
* @param int $level The level at which the decision took place and at which
|
||||
* @param int $level The level at which the decision took place and at which
|
||||
* all resulting decisions should be made.
|
||||
* @param Callable $decisionsSatisfyCallback A callback which checks if a
|
||||
* literal has already been positively decided and the rule is thus
|
||||
|
|
|
@ -99,7 +99,7 @@ class RuleWatchNode
|
|||
* Moves a watch from one literal to another
|
||||
*
|
||||
* @param int $from The previously watched literal
|
||||
* @param int $to The literal to be watched now
|
||||
* @param int $to The literal to be watched now
|
||||
*/
|
||||
public function moveWatch($from, $to)
|
||||
{
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
namespace Composer\DependencyResolver;
|
||||
|
||||
use Composer\Repository\RepositoryInterface;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\DependencyResolver\Operation;
|
||||
|
||||
/**
|
||||
* @author Nils Adermann <naderman@naderman.de>
|
||||
|
@ -119,7 +117,7 @@ class Solver
|
|||
$assertRuleLiterals = $assertRule->getLiterals();
|
||||
$assertRuleLiteral = $assertRuleLiterals[0];
|
||||
|
||||
if (abs($literal) !== abs($assertRuleLiteral)) {
|
||||
if (abs($literal) !== abs($assertRuleLiteral)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -202,12 +200,14 @@ class Solver
|
|||
}
|
||||
|
||||
$transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisionMap, $this->decisionQueue, $this->decisionQueueWhy);
|
||||
|
||||
return $transaction->getOperations();
|
||||
}
|
||||
|
||||
protected function literalFromId($id)
|
||||
{
|
||||
$package = $this->pool->packageById(abs($id));
|
||||
|
||||
return new Literal($package, $id > 0);
|
||||
}
|
||||
|
||||
|
@ -241,6 +241,7 @@ class Solver
|
|||
public function decisionsContain($literal)
|
||||
{
|
||||
$packageId = abs($literal);
|
||||
|
||||
return (
|
||||
$this->decisionMap[$packageId] > 0 && $literal > 0 ||
|
||||
$this->decisionMap[$packageId] < 0 && $literal < 0
|
||||
|
@ -250,6 +251,7 @@ class Solver
|
|||
protected function decisionsSatisfy($literal)
|
||||
{
|
||||
$packageId = abs($literal);
|
||||
|
||||
return (
|
||||
$literal > 0 && $this->decisionMap[$packageId] > 0 ||
|
||||
$literal < 0 && $this->decisionMap[$packageId] < 0
|
||||
|
@ -259,6 +261,7 @@ class Solver
|
|||
public function decisionsConflict($literal)
|
||||
{
|
||||
$packageId = abs($literal);
|
||||
|
||||
return (
|
||||
($this->decisionMap[$packageId] > 0 && $literal < 0) ||
|
||||
($this->decisionMap[$packageId] < 0 && $literal > 0)
|
||||
|
@ -274,7 +277,8 @@ class Solver
|
|||
return $this->decisionMap[$packageId] == 0;
|
||||
}
|
||||
|
||||
protected function decidedInstall($packageId) {
|
||||
protected function decidedInstall($packageId)
|
||||
{
|
||||
return $this->decisionMap[$packageId] > 0;
|
||||
}
|
||||
|
||||
|
@ -433,7 +437,7 @@ class Solver
|
|||
|
||||
$this->learnedPool[] = array();
|
||||
|
||||
while(true) {
|
||||
while (true) {
|
||||
$this->learnedPool[count($this->learnedPool) - 1][] = $rule;
|
||||
|
||||
foreach ($rule->getLiterals() as $literal) {
|
||||
|
@ -535,6 +539,7 @@ class Solver
|
|||
foreach ($problemRules as $problemRule) {
|
||||
$this->analyzeUnsolvableRule($problem, $problemRule);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -600,6 +605,7 @@ class Solver
|
|||
}
|
||||
|
||||
$this->resetSolver();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ class Transaction
|
|||
$package, $this->decisionQueueWhy[$i]
|
||||
);
|
||||
}
|
||||
} else if (!isset($ignoreRemove[$package->getId()])) {
|
||||
} elseif (!isset($ignoreRemove[$package->getId()])) {
|
||||
if ($package instanceof AliasPackage) {
|
||||
$transaction[] = new Operation\MarkAliasInstalledOperation(
|
||||
$package, $this->decisionQueueWhy[$i]
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace Composer\Downloader;
|
||||
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Package\PackageInterface;
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ class DownloadManager
|
|||
/**
|
||||
* Initializes download manager.
|
||||
*
|
||||
* @param Boolean $preferSource prefer downloading from source
|
||||
* @param Boolean $preferSource prefer downloading from source
|
||||
*/
|
||||
public function __construct($preferSource = false, Filesystem $filesystem = null)
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ class DownloadManager
|
|||
/**
|
||||
* Makes downloader prefer source installation over the dist.
|
||||
*
|
||||
* @param Boolean $preferSource prefer downloading from source
|
||||
* @param Boolean $preferSource prefer downloading from source
|
||||
*/
|
||||
public function setPreferSource($preferSource)
|
||||
{
|
||||
|
@ -53,8 +53,8 @@ class DownloadManager
|
|||
/**
|
||||
* Sets installer downloader for a specific installation type.
|
||||
*
|
||||
* @param string $type installation type
|
||||
* @param DownloaderInterface $downloader downloader instance
|
||||
* @param string $type installation type
|
||||
* @param DownloaderInterface $downloader downloader instance
|
||||
*/
|
||||
public function setDownloader($type, DownloaderInterface $downloader)
|
||||
{
|
||||
|
@ -67,11 +67,11 @@ class DownloadManager
|
|||
/**
|
||||
* Returns downloader for a specific installation type.
|
||||
*
|
||||
* @param string $type installation type
|
||||
* @param string $type installation type
|
||||
*
|
||||
* @return DownloaderInterface
|
||||
* @return DownloaderInterface
|
||||
*
|
||||
* @throws UnexpectedValueException if downloader for provided type is not registeterd
|
||||
* @throws UnexpectedValueException if downloader for provided type is not registeterd
|
||||
*/
|
||||
public function getDownloader($type)
|
||||
{
|
||||
|
@ -86,12 +86,12 @@ class DownloadManager
|
|||
/**
|
||||
* Returns downloader for already installed package.
|
||||
*
|
||||
* @param PackageInterface $package package instance
|
||||
* @param PackageInterface $package package instance
|
||||
*
|
||||
* @return DownloaderInterface
|
||||
* @return DownloaderInterface
|
||||
*
|
||||
* @throws InvalidArgumentException if package has no installation source specified
|
||||
* @throws LogicException if specific downloader used to load package with
|
||||
* @throws InvalidArgumentException if package has no installation source specified
|
||||
* @throws LogicException if specific downloader used to load package with
|
||||
* wrong type
|
||||
*/
|
||||
public function getDownloaderForInstalledPackage(PackageInterface $package)
|
||||
|
@ -121,11 +121,11 @@ class DownloadManager
|
|||
/**
|
||||
* Downloads package into target dir.
|
||||
*
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $targetDir target dir
|
||||
* @param Boolean $preferSource prefer installation from source
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $targetDir target dir
|
||||
* @param Boolean $preferSource prefer installation from source
|
||||
*
|
||||
* @throws InvalidArgumentException if package have no urls to download from
|
||||
* @throws InvalidArgumentException if package have no urls to download from
|
||||
*/
|
||||
public function download(PackageInterface $package, $targetDir, $preferSource = null)
|
||||
{
|
||||
|
@ -152,11 +152,11 @@ class DownloadManager
|
|||
/**
|
||||
* Updates package from initial to target version.
|
||||
*
|
||||
* @param PackageInterface $initial initial package version
|
||||
* @param PackageInterface $target target package version
|
||||
* @param string $targetDir target dir
|
||||
* @param PackageInterface $initial initial package version
|
||||
* @param PackageInterface $target target package version
|
||||
* @param string $targetDir target dir
|
||||
*
|
||||
* @throws InvalidArgumentException if initial package is not installed
|
||||
* @throws InvalidArgumentException if initial package is not installed
|
||||
*/
|
||||
public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
|
||||
{
|
||||
|
@ -175,6 +175,7 @@ class DownloadManager
|
|||
if ($target->isDev() && 'dist' === $installationSource) {
|
||||
$downloader->remove($initial, $targetDir);
|
||||
$this->download($target, $targetDir);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -190,8 +191,8 @@ class DownloadManager
|
|||
/**
|
||||
* Removes package from target dir.
|
||||
*
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $targetDir target dir
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $targetDir target dir
|
||||
*/
|
||||
public function remove(PackageInterface $package, $targetDir)
|
||||
{
|
||||
|
|
|
@ -25,32 +25,32 @@ interface DownloaderInterface
|
|||
/**
|
||||
* Returns installation source (either source or dist).
|
||||
*
|
||||
* @return string "source" or "dist"
|
||||
* @return string "source" or "dist"
|
||||
*/
|
||||
function getInstallationSource();
|
||||
|
||||
/**
|
||||
* Downloads specific package into specific folder.
|
||||
*
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $path download path
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $path download path
|
||||
*/
|
||||
function download(PackageInterface $package, $path);
|
||||
|
||||
/**
|
||||
* Updates specific package in specific folder from initial to target version.
|
||||
*
|
||||
* @param PackageInterface $initial initial package
|
||||
* @param PackageInterface $target updated package
|
||||
* @param string $path download path
|
||||
* @param PackageInterface $initial initial package
|
||||
* @param PackageInterface $target updated package
|
||||
* @param string $path download path
|
||||
*/
|
||||
function update(PackageInterface $initial, PackageInterface $target, $path);
|
||||
|
||||
/**
|
||||
* Removes specific package from specific folder.
|
||||
*
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $path download path
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $path download path
|
||||
*/
|
||||
function remove(PackageInterface $package, $path);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ class FileDownloader implements DownloaderInterface
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param IOInterface $io The IO instance
|
||||
* @param IOInterface $io The IO instance
|
||||
*/
|
||||
public function __construct(IOInterface $io, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
|
||||
{
|
||||
|
@ -110,9 +110,9 @@ class FileDownloader implements DownloaderInterface
|
|||
/**
|
||||
* Gets file name for specific package
|
||||
*
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $path download path
|
||||
* @return string file name
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $path download path
|
||||
* @return string file name
|
||||
*/
|
||||
protected function getFileName(PackageInterface $package, $path)
|
||||
{
|
||||
|
@ -122,7 +122,7 @@ class FileDownloader implements DownloaderInterface
|
|||
/**
|
||||
* Process the download url
|
||||
*
|
||||
* @param string $url download url
|
||||
* @param string $url download url
|
||||
* @return string url
|
||||
*
|
||||
* @throws \RuntimeException If any problem with the url
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
namespace Composer\Downloader;
|
||||
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
|
||||
/**
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
|
@ -80,9 +79,9 @@ class GitDownloader extends VcsDownloader
|
|||
/**
|
||||
* Runs a command doing attempts for each protocol supported by github.
|
||||
*
|
||||
* @param callable $commandCallable A callable building the command for the given url
|
||||
* @param string $url
|
||||
* @param string $path The directory to remove for each attempt (null if not needed)
|
||||
* @param callable $commandCallable A callable building the command for the given url
|
||||
* @param string $url
|
||||
* @param string $path The directory to remove for each attempt (null if not needed)
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
protected function runCommand($commandCallable, $url, $path = null)
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
namespace Composer\Downloader;
|
||||
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
|
||||
/**
|
||||
* @author Per Bernhardt <plb@webfactory.de>
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace Composer\Downloader;
|
||||
|
||||
use Composer\Package\PackageInterface;
|
||||
|
||||
/**
|
||||
* Downloader for pear packages
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace Composer\Downloader;
|
||||
|
||||
use Composer\Package\PackageInterface;
|
||||
|
||||
/**
|
||||
* Downloader for phar files
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
namespace Composer\Downloader;
|
||||
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Composer\Util\Svn as SvnUtil;
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace Composer\Downloader;
|
||||
|
||||
use Composer\Package\PackageInterface;
|
||||
|
||||
/**
|
||||
* Downloader for tar files: tar, tar.gz or tar.bz2
|
||||
|
|
|
@ -86,17 +86,17 @@ abstract class VcsDownloader implements DownloaderInterface
|
|||
/**
|
||||
* Downloads specific package into specific folder.
|
||||
*
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $path download path
|
||||
* @param PackageInterface $package package instance
|
||||
* @param string $path download path
|
||||
*/
|
||||
abstract protected function doDownload(PackageInterface $package, $path);
|
||||
|
||||
/**
|
||||
* Updates specific package in specific folder from initial to target version.
|
||||
*
|
||||
* @param PackageInterface $initial initial package
|
||||
* @param PackageInterface $target updated package
|
||||
* @param string $path download path
|
||||
* @param PackageInterface $initial initial package
|
||||
* @param PackageInterface $target updated package
|
||||
* @param string $path download path
|
||||
*/
|
||||
abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path);
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace Composer\Downloader;
|
||||
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Composer\IO\IOInterface;
|
||||
use ZipArchive;
|
||||
|
@ -62,8 +61,8 @@ class ZipDownloader extends ArchiveDownloader
|
|||
/**
|
||||
* Give a meaningful error message to the user.
|
||||
*
|
||||
* @param int $retval
|
||||
* @param string $file
|
||||
* @param int $retval
|
||||
* @param string $file
|
||||
* @return string
|
||||
*/
|
||||
protected function getErrorMessage($retval, $file)
|
||||
|
|
|
@ -65,8 +65,8 @@ class Factory
|
|||
/**
|
||||
* Creates a Composer instance
|
||||
*
|
||||
* @param IOInterface $io IO instance
|
||||
* @param mixed $localConfig either a configuration array or a filename to read from, if null it will read from the default filename
|
||||
* @param IOInterface $io IO instance
|
||||
* @param mixed $localConfig either a configuration array or a filename to read from, if null it will read from the default filename
|
||||
* @return Composer
|
||||
*/
|
||||
public function createComposer(IOInterface $io, $localConfig = null)
|
||||
|
@ -250,8 +250,8 @@ class Factory
|
|||
}
|
||||
|
||||
/**
|
||||
* @param IOInterface $io IO instance
|
||||
* @param mixed $config either a configuration array or a filename to read from, if null it will read from the default filename
|
||||
* @param IOInterface $io IO instance
|
||||
* @param mixed $config either a configuration array or a filename to read from, if null it will read from the default filename
|
||||
* @return Composer
|
||||
*/
|
||||
static public function create(IOInterface $io, $config = null)
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
namespace Composer\IO;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputDefinition;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
|
||||
use Symfony\Component\Console\Helper\HelperSet;
|
||||
|
||||
/**
|
||||
|
|
|
@ -60,8 +60,8 @@ interface IOInterface
|
|||
/**
|
||||
* Asks a question to the user.
|
||||
*
|
||||
* @param string|array $question The question to ask
|
||||
* @param string $default The default answer if none is given by the user
|
||||
* @param string|array $question The question to ask
|
||||
* @param string $default The default answer if none is given by the user
|
||||
*
|
||||
* @return string The user answer
|
||||
*
|
||||
|
@ -74,8 +74,8 @@ interface IOInterface
|
|||
*
|
||||
* The question will be asked until the user answers by nothing, yes, or no.
|
||||
*
|
||||
* @param string|array $question The question to ask
|
||||
* @param Boolean $default The default answer if the user enters nothing
|
||||
* @param string|array $question The question to ask
|
||||
* @param Boolean $default The default answer if the user enters nothing
|
||||
*
|
||||
* @return Boolean true if the user has confirmed, false otherwise
|
||||
*/
|
||||
|
@ -88,10 +88,10 @@ interface IOInterface
|
|||
* validated data when the data is valid and throw an exception
|
||||
* otherwise.
|
||||
*
|
||||
* @param string|array $question The question to ask
|
||||
* @param callback $validator A PHP callback
|
||||
* @param integer $attempts Max number of times to ask before giving up (false by default, which means infinite)
|
||||
* @param string $default The default answer if none is given by the user
|
||||
* @param string|array $question The question to ask
|
||||
* @param callback $validator A PHP callback
|
||||
* @param integer $attempts Max number of times to ask before giving up (false by default, which means infinite)
|
||||
* @param string $default The default answer if none is given by the user
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
|
|
|
@ -27,7 +27,6 @@ use Composer\Package\Link;
|
|||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Package\Locker;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Repository\ArrayRepository;
|
||||
use Composer\Repository\CompositeRepository;
|
||||
use Composer\Repository\InstalledArrayRepository;
|
||||
use Composer\Repository\PlatformRepository;
|
||||
|
@ -102,14 +101,14 @@ class Installer
|
|||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param IOInterface $io
|
||||
* @param PackageInterface $package
|
||||
* @param DownloadManager $downloadManager
|
||||
* @param RepositoryManager $repositoryManager
|
||||
* @param Locker $locker
|
||||
* @param IOInterface $io
|
||||
* @param PackageInterface $package
|
||||
* @param DownloadManager $downloadManager
|
||||
* @param RepositoryManager $repositoryManager
|
||||
* @param Locker $locker
|
||||
* @param InstallationManager $installationManager
|
||||
* @param EventDispatcher $eventDispatcher
|
||||
* @param AutoloadGenerator $autoloadGenerator
|
||||
* @param EventDispatcher $eventDispatcher
|
||||
* @param AutoloadGenerator $autoloadGenerator
|
||||
*/
|
||||
public function __construct(IOInterface $io, PackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
|
||||
{
|
||||
|
@ -447,10 +446,10 @@ class Installer
|
|||
/**
|
||||
* Create Installer
|
||||
*
|
||||
* @param IOInterface $io
|
||||
* @param Composer $composer
|
||||
* @param EventDispatcher $eventDispatcher
|
||||
* @param AutoloadGenerator $autoloadGenerator
|
||||
* @param IOInterface $io
|
||||
* @param Composer $composer
|
||||
* @param EventDispatcher $eventDispatcher
|
||||
* @param AutoloadGenerator $autoloadGenerator
|
||||
* @return Installer
|
||||
*/
|
||||
static public function create(IOInterface $io, Composer $composer, EventDispatcher $eventDispatcher = null, AutoloadGenerator $autoloadGenerator = null)
|
||||
|
@ -480,7 +479,7 @@ class Installer
|
|||
/**
|
||||
* wether to run in drymode or not
|
||||
*
|
||||
* @param boolean $dryRun
|
||||
* @param boolean $dryRun
|
||||
* @return Installer
|
||||
*/
|
||||
public function setDryRun($dryRun = true)
|
||||
|
@ -493,7 +492,7 @@ class Installer
|
|||
/**
|
||||
* prefer source installation
|
||||
*
|
||||
* @param boolean $preferSource
|
||||
* @param boolean $preferSource
|
||||
* @return Installer
|
||||
*/
|
||||
public function setPreferSource($preferSource = true)
|
||||
|
@ -506,7 +505,7 @@ class Installer
|
|||
/**
|
||||
* update packages
|
||||
*
|
||||
* @param boolean $update
|
||||
* @param boolean $update
|
||||
* @return Installer
|
||||
*/
|
||||
public function setUpdate($update = true)
|
||||
|
@ -519,7 +518,7 @@ class Installer
|
|||
/**
|
||||
* enables dev packages
|
||||
*
|
||||
* @param boolean $update
|
||||
* @param boolean $update
|
||||
* @return Installer
|
||||
*/
|
||||
public function setDevMode($devMode = true)
|
||||
|
@ -532,7 +531,7 @@ class Installer
|
|||
/**
|
||||
* run in verbose mode
|
||||
*
|
||||
* @param boolean $verbose
|
||||
* @param boolean $verbose
|
||||
* @return Installer
|
||||
*/
|
||||
public function setVerbose($verbose = true)
|
||||
|
|
|
@ -40,8 +40,8 @@ class InstallationManager
|
|||
/**
|
||||
* Creates an instance of InstallationManager
|
||||
*
|
||||
* @param string $vendorDir Relative path to the vendor directory
|
||||
* @throws \InvalidArgumentException
|
||||
* @param string $vendorDir Relative path to the vendor directory
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct($vendorDir = 'vendor')
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ class InstallationManager
|
|||
/**
|
||||
* Adds installer
|
||||
*
|
||||
* @param InstallerInterface $installer installer instance
|
||||
* @param InstallerInterface $installer installer instance
|
||||
*/
|
||||
public function addInstaller(InstallerInterface $installer)
|
||||
{
|
||||
|
@ -73,11 +73,11 @@ class InstallationManager
|
|||
/**
|
||||
* Returns installer for a specific package type.
|
||||
*
|
||||
* @param string $type package type
|
||||
* @param string $type package type
|
||||
*
|
||||
* @return InstallerInterface
|
||||
* @return InstallerInterface
|
||||
*
|
||||
* @throws InvalidArgumentException if installer for provided type is not registered
|
||||
* @throws InvalidArgumentException if installer for provided type is not registered
|
||||
*/
|
||||
public function getInstaller($type)
|
||||
{
|
||||
|
@ -99,10 +99,10 @@ class InstallationManager
|
|||
/**
|
||||
* Checks whether provided package is installed in one of the registered installers.
|
||||
*
|
||||
* @param InstalledRepositoryInterface $repo repository in which to check
|
||||
* @param PackageInterface $package package instance
|
||||
* @param InstalledRepositoryInterface $repo repository in which to check
|
||||
* @param PackageInterface $package package instance
|
||||
*
|
||||
* @return Boolean
|
||||
* @return Boolean
|
||||
*/
|
||||
public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
|
||||
{
|
||||
|
@ -116,8 +116,8 @@ class InstallationManager
|
|||
/**
|
||||
* Executes solver operation.
|
||||
*
|
||||
* @param RepositoryInterface $repo repository in which to check
|
||||
* @param OperationInterface $operation operation instance
|
||||
* @param RepositoryInterface $repo repository in which to check
|
||||
* @param OperationInterface $operation operation instance
|
||||
*/
|
||||
public function execute(RepositoryInterface $repo, OperationInterface $operation)
|
||||
{
|
||||
|
@ -128,8 +128,8 @@ class InstallationManager
|
|||
/**
|
||||
* Executes install operation.
|
||||
*
|
||||
* @param RepositoryInterface $repo repository in which to check
|
||||
* @param InstallOperation $operation operation instance
|
||||
* @param RepositoryInterface $repo repository in which to check
|
||||
* @param InstallOperation $operation operation instance
|
||||
*/
|
||||
public function install(RepositoryInterface $repo, InstallOperation $operation)
|
||||
{
|
||||
|
@ -142,8 +142,8 @@ class InstallationManager
|
|||
/**
|
||||
* Executes update operation.
|
||||
*
|
||||
* @param RepositoryInterface $repo repository in which to check
|
||||
* @param InstallOperation $operation operation instance
|
||||
* @param RepositoryInterface $repo repository in which to check
|
||||
* @param InstallOperation $operation operation instance
|
||||
*/
|
||||
public function update(RepositoryInterface $repo, UpdateOperation $operation)
|
||||
{
|
||||
|
@ -166,8 +166,8 @@ class InstallationManager
|
|||
/**
|
||||
* Uninstalls package.
|
||||
*
|
||||
* @param RepositoryInterface $repo repository in which to check
|
||||
* @param UninstallOperation $operation operation instance
|
||||
* @param RepositoryInterface $repo repository in which to check
|
||||
* @param UninstallOperation $operation operation instance
|
||||
*/
|
||||
public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
|
||||
{
|
||||
|
@ -179,8 +179,8 @@ class InstallationManager
|
|||
/**
|
||||
* Executes markAliasInstalled operation.
|
||||
*
|
||||
* @param RepositoryInterface $repo repository in which to check
|
||||
* @param MarkAliasInstalledOperation $operation operation instance
|
||||
* @param RepositoryInterface $repo repository in which to check
|
||||
* @param MarkAliasInstalledOperation $operation operation instance
|
||||
*/
|
||||
public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
|
||||
{
|
||||
|
@ -194,8 +194,8 @@ class InstallationManager
|
|||
/**
|
||||
* Executes markAlias operation.
|
||||
*
|
||||
* @param RepositoryInterface $repo repository in which to check
|
||||
* @param MarkAliasUninstalledOperation $operation operation instance
|
||||
* @param RepositoryInterface $repo repository in which to check
|
||||
* @param MarkAliasUninstalledOperation $operation operation instance
|
||||
*/
|
||||
public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
|
||||
{
|
||||
|
@ -207,20 +207,21 @@ class InstallationManager
|
|||
/**
|
||||
* Returns the installation path of a package
|
||||
*
|
||||
* @param PackageInterface $package
|
||||
* @return string path
|
||||
* @param PackageInterface $package
|
||||
* @return string path
|
||||
*/
|
||||
public function getInstallPath(PackageInterface $package)
|
||||
{
|
||||
$installer = $this->getInstaller($package->getType());
|
||||
|
||||
return $installer->getInstallPath($package);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the vendor path
|
||||
*
|
||||
* @param boolean $absolute Whether or not to return an absolute path
|
||||
* @return string path
|
||||
* @param boolean $absolute Whether or not to return an absolute path
|
||||
* @return string path
|
||||
*/
|
||||
public function getVendorPath($absolute = false)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,6 @@ use Composer\IO\IOInterface;
|
|||
use Composer\Autoload\AutoloadGenerator;
|
||||
use Composer\Downloader\DownloadManager;
|
||||
use Composer\Repository\InstalledRepositoryInterface;
|
||||
use Composer\DependencyResolver\Operation\OperationInterface;
|
||||
use Composer\Package\PackageInterface;
|
||||
|
||||
/**
|
||||
|
@ -30,12 +29,12 @@ class InstallerInstaller extends LibraryInstaller
|
|||
private static $classCounter = 0;
|
||||
|
||||
/**
|
||||
* @param string $vendorDir relative path for packages home
|
||||
* @param string $binDir relative path for binaries
|
||||
* @param DownloadManager $dm download manager
|
||||
* @param IOInterface $io io instance
|
||||
* @param InstallationManager $im installation manager
|
||||
* @param array $localRepositories array of InstalledRepositoryInterface
|
||||
* @param string $vendorDir relative path for packages home
|
||||
* @param string $binDir relative path for binaries
|
||||
* @param DownloadManager $dm download manager
|
||||
* @param IOInterface $io io instance
|
||||
* @param InstallationManager $im installation manager
|
||||
* @param array $localRepositories array of InstalledRepositoryInterface
|
||||
*/
|
||||
public function __construct($vendorDir, $binDir, DownloadManager $dm, IOInterface $io, InstallationManager $im, array $localRepositories)
|
||||
{
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace Composer\Installer;
|
||||
|
||||
use Composer\DependencyResolver\Operation\OperationInterface;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Repository\InstalledRepositoryInterface;
|
||||
|
||||
|
@ -27,53 +26,53 @@ interface InstallerInterface
|
|||
/**
|
||||
* Decides if the installer supports the given type
|
||||
*
|
||||
* @param string $packageType
|
||||
* @return Boolean
|
||||
* @param string $packageType
|
||||
* @return Boolean
|
||||
*/
|
||||
function supports($packageType);
|
||||
|
||||
/**
|
||||
* Checks that provided package is installed.
|
||||
*
|
||||
* @param InstalledRepositoryInterface $repo repository in which to check
|
||||
* @param PackageInterface $package package instance
|
||||
* @param InstalledRepositoryInterface $repo repository in which to check
|
||||
* @param PackageInterface $package package instance
|
||||
*
|
||||
* @return Boolean
|
||||
* @return Boolean
|
||||
*/
|
||||
function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
|
||||
|
||||
/**
|
||||
* Installs specific package.
|
||||
*
|
||||
* @param InstalledRepositoryInterface $repo repository in which to check
|
||||
* @param PackageInterface $package package instance
|
||||
* @param InstalledRepositoryInterface $repo repository in which to check
|
||||
* @param PackageInterface $package package instance
|
||||
*/
|
||||
function install(InstalledRepositoryInterface $repo, PackageInterface $package);
|
||||
|
||||
/**
|
||||
* Updates specific package.
|
||||
*
|
||||
* @param InstalledRepositoryInterface $repo repository in which to check
|
||||
* @param PackageInterface $initial already installed package version
|
||||
* @param PackageInterface $target updated version
|
||||
* @param InstalledRepositoryInterface $repo repository in which to check
|
||||
* @param PackageInterface $initial already installed package version
|
||||
* @param PackageInterface $target updated version
|
||||
*
|
||||
* @throws InvalidArgumentException if $from package is not installed
|
||||
* @throws InvalidArgumentException if $from package is not installed
|
||||
*/
|
||||
function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
|
||||
|
||||
/**
|
||||
* Uninstalls specific package.
|
||||
*
|
||||
* @param InstalledRepositoryInterface $repo repository in which to check
|
||||
* @param PackageInterface $package package instance
|
||||
* @param InstalledRepositoryInterface $repo repository in which to check
|
||||
* @param PackageInterface $package package instance
|
||||
*/
|
||||
function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
|
||||
|
||||
/**
|
||||
* Returns the installation path of a package
|
||||
*
|
||||
* @param PackageInterface $package
|
||||
* @return string path
|
||||
* @param PackageInterface $package
|
||||
* @return string path
|
||||
*/
|
||||
function getInstallPath(PackageInterface $package);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ namespace Composer\Installer;
|
|||
use Composer\IO\IOInterface;
|
||||
use Composer\Downloader\DownloadManager;
|
||||
use Composer\Repository\InstalledRepositoryInterface;
|
||||
use Composer\DependencyResolver\Operation\OperationInterface;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Util\Filesystem;
|
||||
|
||||
|
@ -37,11 +36,11 @@ class LibraryInstaller implements InstallerInterface
|
|||
/**
|
||||
* Initializes library installer.
|
||||
*
|
||||
* @param string $vendorDir relative path for packages home
|
||||
* @param string $binDir relative path for binaries
|
||||
* @param DownloadManager $dm download manager
|
||||
* @param IOInterface $io io instance
|
||||
* @param string $type package type that this installer handles
|
||||
* @param string $vendorDir relative path for packages home
|
||||
* @param string $binDir relative path for binaries
|
||||
* @param DownloadManager $dm download manager
|
||||
* @param IOInterface $io io instance
|
||||
* @param string $type package type that this installer handles
|
||||
*/
|
||||
public function __construct($vendorDir, $binDir, DownloadManager $dm, IOInterface $io, $type = 'library')
|
||||
{
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace Composer\Installer;
|
||||
|
||||
use Composer\DependencyResolver\Operation\OperationInterface;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Downloader\DownloadManager;
|
||||
use Composer\Repository\InstalledRepositoryInterface;
|
||||
|
@ -37,8 +36,8 @@ class ProjectInstaller implements InstallerInterface
|
|||
/**
|
||||
* Decides if the installer supports the given type
|
||||
*
|
||||
* @param string $packageType
|
||||
* @return Boolean
|
||||
* @param string $packageType
|
||||
* @return Boolean
|
||||
*/
|
||||
public function supports($packageType)
|
||||
{
|
||||
|
@ -88,8 +87,8 @@ class ProjectInstaller implements InstallerInterface
|
|||
/**
|
||||
* Returns the installation path of a package
|
||||
*
|
||||
* @param PackageInterface $package
|
||||
* @return string path
|
||||
* @param PackageInterface $package
|
||||
* @return string path
|
||||
*/
|
||||
public function getInstallPath(PackageInterface $package)
|
||||
{
|
||||
|
|
|
@ -12,11 +12,9 @@
|
|||
|
||||
namespace Composer\Json;
|
||||
|
||||
use Composer\Repository\RepositoryManager;
|
||||
use Composer\Composer;
|
||||
use JsonSchema\Validator;
|
||||
use Seld\JsonLint\JsonParser;
|
||||
use Composer\Util\StreamContextFactory;
|
||||
use Composer\Util\RemoteFilesystem;
|
||||
use Composer\Downloader\TransportException;
|
||||
|
||||
|
@ -41,8 +39,8 @@ class JsonFile
|
|||
/**
|
||||
* Initializes json file reader/parser.
|
||||
*
|
||||
* @param string $lockFile path to a lockfile
|
||||
* @param RemoteFilesystem $rfs required for loading http/https json files
|
||||
* @param string $lockFile path to a lockfile
|
||||
* @param RemoteFilesystem $rfs required for loading http/https json files
|
||||
*/
|
||||
public function __construct($path, RemoteFilesystem $rfs = null)
|
||||
{
|
||||
|
@ -62,7 +60,7 @@ class JsonFile
|
|||
/**
|
||||
* Checks whether json file exists.
|
||||
*
|
||||
* @return Boolean
|
||||
* @return Boolean
|
||||
*/
|
||||
public function exists()
|
||||
{
|
||||
|
@ -72,7 +70,7 @@ class JsonFile
|
|||
/**
|
||||
* Reads json file.
|
||||
*
|
||||
* @return array
|
||||
* @return array
|
||||
*/
|
||||
public function read()
|
||||
{
|
||||
|
@ -94,8 +92,8 @@ class JsonFile
|
|||
/**
|
||||
* Writes json file.
|
||||
*
|
||||
* @param array $hash writes hash into json file
|
||||
* @param int $options json_encode options (defaults to JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)
|
||||
* @param array $hash writes hash into json file
|
||||
* @param int $options json_encode options (defaults to JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)
|
||||
*/
|
||||
public function write(array $hash, $options = 448)
|
||||
{
|
||||
|
@ -118,8 +116,8 @@ class JsonFile
|
|||
/**
|
||||
* Validates the schema of the current json file according to composer-schema.json rules
|
||||
*
|
||||
* @param int $schema a JsonFile::*_SCHEMA constant
|
||||
* @return Boolean true on success
|
||||
* @param int $schema a JsonFile::*_SCHEMA constant
|
||||
* @return Boolean true on success
|
||||
* @throws \UnexpectedValueException
|
||||
*/
|
||||
public function validateSchema($schema = self::STRICT_SCHEMA)
|
||||
|
@ -164,8 +162,8 @@ class JsonFile
|
|||
*
|
||||
* Originally licensed under MIT by Dave Perrett <mail@recursive-design.com>
|
||||
*
|
||||
* @param mixed $data Data to encode into a formatted JSON string
|
||||
* @param int $options json_encode options (defaults to JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)
|
||||
* @param mixed $data Data to encode into a formatted JSON string
|
||||
* @param int $options json_encode options (defaults to JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)
|
||||
* @return string Encoded json
|
||||
*/
|
||||
static public function encode($data, $options = 448)
|
||||
|
@ -268,7 +266,7 @@ class JsonFile
|
|||
*
|
||||
* @param string $json json string
|
||||
*
|
||||
* @return mixed
|
||||
* @return mixed
|
||||
*/
|
||||
public static function parseJson($json)
|
||||
{
|
||||
|
@ -283,8 +281,8 @@ class JsonFile
|
|||
/**
|
||||
* Validates the syntax of a JSON string
|
||||
*
|
||||
* @param string $json
|
||||
* @return Boolean true on success
|
||||
* @param string $json
|
||||
* @return Boolean true on success
|
||||
* @throws \UnexpectedValueException
|
||||
*/
|
||||
protected static function validateSyntax($json)
|
||||
|
|
|
@ -12,10 +12,7 @@
|
|||
|
||||
namespace Composer\Package;
|
||||
|
||||
use Composer\Package\LinkConstraint\LinkConstraintInterface;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Repository\RepositoryInterface;
|
||||
use Composer\Repository\PlatformRepository;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
|
||||
/**
|
||||
|
@ -40,9 +37,9 @@ class AliasPackage extends BasePackage
|
|||
/**
|
||||
* All descendants' constructors should call this parent constructor
|
||||
*
|
||||
* @param PackageInterface $aliasOf The package this package is an alias of
|
||||
* @param string $version The version the alias must report
|
||||
* @param string $prettyVersion The alias's non-normalized version
|
||||
* @param PackageInterface $aliasOf The package this package is an alias of
|
||||
* @param string $version The version the alias must report
|
||||
* @param string $prettyVersion The alias's non-normalized version
|
||||
*/
|
||||
public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
|
||||
{
|
||||
|
|
|
@ -120,9 +120,9 @@ abstract class BasePackage implements PackageInterface
|
|||
* Checks if the package matches the given constraint directly or through
|
||||
* provided or replaced packages
|
||||
*
|
||||
* @param string $name Name of the package to be matched
|
||||
* @param LinkConstraintInterface $constraint The constraint to verify
|
||||
* @return bool Whether this package matches the name and constraint
|
||||
* @param string $name Name of the package to be matched
|
||||
* @param LinkConstraintInterface $constraint The constraint to verify
|
||||
* @return bool Whether this package matches the name and constraint
|
||||
*/
|
||||
public function matches($name, LinkConstraintInterface $constraint)
|
||||
{
|
||||
|
@ -187,6 +187,7 @@ abstract class BasePackage implements PackageInterface
|
|||
if ($package instanceof AliasPackage) {
|
||||
$package = $package->getAliasOf();
|
||||
}
|
||||
|
||||
return $package === $self;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ class MultiConstraint implements LinkConstraintInterface
|
|||
foreach ($this->constraints as $constraint) {
|
||||
$constraints[] = $constraint->__toString();
|
||||
}
|
||||
|
||||
return '['.implode(', ', $constraints).']';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ namespace Composer\Package\Loader;
|
|||
|
||||
use Composer\Package;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Repository\RepositoryManager;
|
||||
|
||||
/**
|
||||
* @author Konstantin Kudryashiv <ever.zet@gmail.com>
|
||||
|
|
|
@ -16,7 +16,6 @@ use Composer\Package\BasePackage;
|
|||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Repository\RepositoryManager;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Composer\Package\AliasPackage;
|
||||
|
||||
/**
|
||||
* ArrayLoader built for the sole purpose of loading the root package
|
||||
|
|
|
@ -31,9 +31,9 @@ class Locker
|
|||
/**
|
||||
* Initializes packages locker.
|
||||
*
|
||||
* @param JsonFile $lockFile lockfile loader
|
||||
* @param RepositoryManager $repositoryManager repository manager instance
|
||||
* @param string $hash unique hash of the current composer configuration
|
||||
* @param JsonFile $lockFile lockfile loader
|
||||
* @param RepositoryManager $repositoryManager repository manager instance
|
||||
* @param string $hash unique hash of the current composer configuration
|
||||
*/
|
||||
public function __construct(JsonFile $lockFile, RepositoryManager $repositoryManager, $hash)
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ class Locker
|
|||
/**
|
||||
* Checks whether locker were been locked (lockfile found).
|
||||
*
|
||||
* @param Boolean $dev true to check if dev packages are locked
|
||||
* @param Boolean $dev true to check if dev packages are locked
|
||||
* @return Boolean
|
||||
*/
|
||||
public function isLocked($dev = false)
|
||||
|
@ -77,7 +77,7 @@ class Locker
|
|||
/**
|
||||
* Searches and returns an array of locked packages, retrieved from registered repositories.
|
||||
*
|
||||
* @param Boolean $dev true to retrieve the locked dev packages
|
||||
* @param Boolean $dev true to retrieve the locked dev packages
|
||||
* @return array
|
||||
*/
|
||||
public function getLockedPackages($dev = false)
|
||||
|
@ -168,7 +168,7 @@ class Locker
|
|||
*
|
||||
* @param array $packages array of packages
|
||||
* @param mixed $packages array of dev packages or null if installed without --dev
|
||||
* @param array $aliases array of aliases
|
||||
* @param array $aliases array of aliases
|
||||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
|
|
|
@ -65,8 +65,8 @@ class MemoryPackage extends BasePackage
|
|||
/**
|
||||
* Creates a new in memory package.
|
||||
*
|
||||
* @param string $name The package's name
|
||||
* @param string $version The package's version
|
||||
* @param string $name The package's name
|
||||
* @param string $version The package's version
|
||||
* @param string $prettyVersion The package's non-normalized version
|
||||
*/
|
||||
public function __construct($name, $version, $prettyVersion)
|
||||
|
|
|
@ -62,9 +62,9 @@ interface PackageInterface
|
|||
* Checks if the package matches the given constraint directly or through
|
||||
* provided or replaced packages
|
||||
*
|
||||
* @param string $name Name of the package to be matched
|
||||
* @param LinkConstraintInterface $constraint The constraint to verify
|
||||
* @return bool Whether this package matches the name and constraint
|
||||
* @param string $name Name of the package to be matched
|
||||
* @param LinkConstraintInterface $constraint The constraint to verify
|
||||
* @return bool Whether this package matches the name and constraint
|
||||
*/
|
||||
function matches($name, LinkConstraintInterface $constraint);
|
||||
|
||||
|
@ -99,14 +99,14 @@ interface PackageInterface
|
|||
/**
|
||||
* Sets source from which this package was installed (source/dist).
|
||||
*
|
||||
* @param string $type source/dist
|
||||
* @param string $type source/dist
|
||||
*/
|
||||
function setInstallationSource($type);
|
||||
|
||||
/**
|
||||
* Returns source from which this package was installed (source/dist).
|
||||
*
|
||||
* @param string $type source/dist
|
||||
* @param string $type source/dist
|
||||
*/
|
||||
function getInstallationSource();
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class VersionParser
|
|||
/**
|
||||
* Returns the stability of a version
|
||||
*
|
||||
* @param string $version
|
||||
* @param string $version
|
||||
* @return string
|
||||
*/
|
||||
static public function parseStability($version)
|
||||
|
@ -61,7 +61,7 @@ class VersionParser
|
|||
/**
|
||||
* Normalizes a version string to be able to perform comparisons on it
|
||||
*
|
||||
* @param string $version
|
||||
* @param string $version
|
||||
* @return array
|
||||
*/
|
||||
public function normalize($version)
|
||||
|
@ -123,7 +123,7 @@ class VersionParser
|
|||
/**
|
||||
* Normalizes a branch name to be able to perform comparisons on it
|
||||
*
|
||||
* @param string $version
|
||||
* @param string $version
|
||||
* @return array
|
||||
*/
|
||||
public function normalizeBranch($name)
|
||||
|
@ -139,6 +139,7 @@ class VersionParser
|
|||
for ($i = 1; $i < 5; $i++) {
|
||||
$version .= isset($matches[$i]) ? str_replace('*', 'x', $matches[$i]) : '.x';
|
||||
}
|
||||
|
||||
return str_replace('x', '9999999', $version).'-dev';
|
||||
}
|
||||
|
||||
|
@ -148,7 +149,7 @@ class VersionParser
|
|||
/**
|
||||
* Parses as constraint string into LinkConstraint objects
|
||||
*
|
||||
* @param string $constraints
|
||||
* @param string $constraints
|
||||
* @return \Composer\Package\LinkConstraint\LinkConstraintInterface
|
||||
*/
|
||||
public function parseConstraints($constraints)
|
||||
|
@ -220,6 +221,7 @@ class VersionParser
|
|||
if (preg_match('{^(>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
|
||||
try {
|
||||
$version = $this->normalize($matches[2]);
|
||||
|
||||
return array(new VersionConstraint($matches[1] ?: '=', $version));
|
||||
} catch (\Exception $e) {}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
namespace Composer\Script;
|
||||
|
||||
use Composer\Composer;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Package\PackageInterface;
|
||||
|
||||
/**
|
||||
* The Command Event.
|
||||
|
|
|
@ -12,10 +12,7 @@
|
|||
|
||||
namespace Composer\Script;
|
||||
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Repository\FilesystemRepository;
|
||||
use Composer\Autoload\AutoloadGenerator;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Composer;
|
||||
use Composer\DependencyResolver\Operation\OperationInterface;
|
||||
|
@ -53,7 +50,7 @@ class EventDispatcher
|
|||
/**
|
||||
* Dispatch a package event.
|
||||
*
|
||||
* @param string $eventName The constant in ScriptEvents
|
||||
* @param string $eventName The constant in ScriptEvents
|
||||
* @param OperationInterface $operation The package being installed/updated/removed
|
||||
*/
|
||||
public function dispatchPackageEvent($eventName, OperationInterface $operation)
|
||||
|
@ -96,7 +93,7 @@ class EventDispatcher
|
|||
}
|
||||
|
||||
/**
|
||||
* @param Event $event Event object
|
||||
* @param Event $event Event object
|
||||
* @return array Listeners
|
||||
*/
|
||||
protected function getListeners(Event $event)
|
||||
|
|
|
@ -31,9 +31,9 @@ class PackageEvent extends Event
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $name The event name
|
||||
* @param Composer $composer The composer objet
|
||||
* @param IOInterface $io The IOInterface object
|
||||
* @param string $name The event name
|
||||
* @param Composer $composer The composer objet
|
||||
* @param IOInterface $io The IOInterface object
|
||||
* @param OperationInterface $operation The operation object
|
||||
*/
|
||||
public function __construct($name, Composer $composer, IOInterface $io, OperationInterface $operation)
|
||||
|
|
|
@ -56,9 +56,9 @@ class Filesystem
|
|||
/**
|
||||
* Returns the shortest path from $from to $to
|
||||
*
|
||||
* @param string $from
|
||||
* @param string $to
|
||||
* @param Boolean $directories if true, the source/target are considered to be directories
|
||||
* @param string $from
|
||||
* @param string $to
|
||||
* @param Boolean $directories if true, the source/target are considered to be directories
|
||||
* @return string
|
||||
*/
|
||||
public function findShortestPath($from, $to, $directories = false)
|
||||
|
@ -90,15 +90,16 @@ class Filesystem
|
|||
$commonPath = rtrim($commonPath, '/') . '/';
|
||||
$sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
|
||||
$commonPathCode = str_repeat('../', $sourcePathDepth);
|
||||
|
||||
return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns PHP code that, when executed in $from, will return the path to $to
|
||||
*
|
||||
* @param string $from
|
||||
* @param string $to
|
||||
* @param Boolean $directories if true, the source/target are considered to be directories
|
||||
* @param string $from
|
||||
* @param string $to
|
||||
* @param Boolean $directories if true, the source/target are considered to be directories
|
||||
* @return string
|
||||
*/
|
||||
public function findShortestPathCode($from, $to, $directories = false)
|
||||
|
@ -130,13 +131,14 @@ class Filesystem
|
|||
$sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
|
||||
$commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
|
||||
$relTarget = substr($to, strlen($commonPath));
|
||||
|
||||
return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given path is absolute
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $path
|
||||
* @return Boolean
|
||||
*/
|
||||
public function isAbsolutePath($path)
|
||||
|
|
|
@ -30,8 +30,8 @@ class ProcessExecutor
|
|||
* @param string $command the command to execute
|
||||
* @param mixed $output the output will be written into this var if passed by ref
|
||||
* if a callable is passed it will be used as output handler
|
||||
* @param string $cwd the working directory
|
||||
* @return int statuscode
|
||||
* @param string $cwd the working directory
|
||||
* @return int statuscode
|
||||
*/
|
||||
public function execute($command, &$output = null, $cwd = null)
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ class RemoteFilesystem
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param IOInterface $io The IO instance
|
||||
* @param IOInterface $io The IO instance
|
||||
*/
|
||||
public function __construct(IOInterface $io)
|
||||
{
|
||||
|
|
|
@ -22,9 +22,9 @@ final class StreamContextFactory
|
|||
/**
|
||||
* Creates a context supporting HTTP proxies
|
||||
*
|
||||
* @param array $defaultOptions Options to merge with the default
|
||||
* @param array $defaultParams Parameters to specify on the context
|
||||
* @return resource Default context
|
||||
* @param array $defaultOptions Options to merge with the default
|
||||
* @param array $defaultParams Parameters to specify on the context
|
||||
* @return resource Default context
|
||||
* @throws \RuntimeException if https proxy required and OpenSSL uninstalled
|
||||
*/
|
||||
static public function getContext(array $defaultOptions = array(), array $defaultParams = array())
|
||||
|
|
|
@ -66,10 +66,10 @@ class Svn
|
|||
* Execute an SVN command and try to fix up the process with credentials
|
||||
* if necessary.
|
||||
*
|
||||
* @param string $command SVN command to run
|
||||
* @param string $url SVN url
|
||||
* @param string $cwd Working directory
|
||||
* @param string $path Target for a checkout
|
||||
* @param string $command SVN command to run
|
||||
* @param string $url SVN url
|
||||
* @param string $cwd Working directory
|
||||
* @param string $path Target for a checkout
|
||||
* @param Boolean $verbose Output all output to the user
|
||||
*
|
||||
* @return string
|
||||
|
@ -256,4 +256,4 @@ class Svn
|
|||
{
|
||||
return $this->cacheCredentials ? '' : '--no-auth-cache ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
function includeIfExists($file) {
|
||||
function includeIfExists($file)
|
||||
{
|
||||
if (file_exists($file)) {
|
||||
return include $file;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ return call_user_func(function() {
|
|||
return false;
|
||||
}
|
||||
require_once $path;
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue