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