CS fixes, made EventDispatcher optional in factory method
parent
2b2f7e1748
commit
5f2e42ec46
|
@ -18,7 +18,6 @@ use Composer\Installer\ProjectInstaller;
|
|||
use Composer\IO\IOInterface;
|
||||
use Composer\Repository\ComposerRepository;
|
||||
use Composer\Repository\FilesystemRepository;
|
||||
use Composer\Script\EventDispatcher;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
@ -119,8 +118,7 @@ EOT
|
|||
chdir($directory);
|
||||
|
||||
$composer = Factory::create($io);
|
||||
$eventDispatcher = new EventDispatcher($composer, $io);
|
||||
$installer = Installer::create($io, $composer, $eventDispatcher);
|
||||
$installer = Installer::create($io, $composer);
|
||||
|
||||
$installer->run($preferSource);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
namespace Composer\Command;
|
||||
|
||||
use Composer\Installer;
|
||||
use Composer\Script\EventDispatcher;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
@ -52,15 +51,14 @@ EOT
|
|||
{
|
||||
$composer = $this->getComposer();
|
||||
$io = $this->getApplication()->getIO();
|
||||
$eventDispatcher = new EventDispatcher($composer, $io);
|
||||
$install = Installer::create($io, $composer, $eventDispatcher);
|
||||
$install = Installer::create($io, $composer);
|
||||
|
||||
return $install->run(
|
||||
(Boolean)$input->getOption('prefer-source'),
|
||||
(Boolean)$input->getOption('dry-run'),
|
||||
(Boolean)$input->getOption('verbose'),
|
||||
(Boolean)$input->getOption('no-install-recommends'),
|
||||
(Boolean)$input->getOption('install-suggests')
|
||||
(Boolean) $input->getOption('prefer-source'),
|
||||
(Boolean) $input->getOption('dry-run'),
|
||||
(Boolean) $input->getOption('verbose'),
|
||||
(Boolean) $input->getOption('no-install-recommends'),
|
||||
(Boolean) $input->getOption('install-suggests')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,53 +33,51 @@ use Composer\Repository\RepositoryManager;
|
|||
use Composer\Script\EventDispatcher;
|
||||
use Composer\Script\ScriptEvents;
|
||||
|
||||
/**
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @author Beau Simensen <beau@dflydev.com>
|
||||
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
||||
*/
|
||||
class Installer
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var IOInterface
|
||||
*/
|
||||
protected $io;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var PackageInterface
|
||||
*/
|
||||
protected $package;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var DownloadManager
|
||||
*/
|
||||
protected $downloadManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var RepositoryManager
|
||||
*/
|
||||
protected $repositoryManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Locker
|
||||
*/
|
||||
protected $locker;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var InstallationManager
|
||||
*/
|
||||
protected $installationManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var EventDispatcher
|
||||
*/
|
||||
protected $eventDispatcher;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*
|
||||
* @param IOInterface $io
|
||||
* @param PackageInterface $package
|
||||
* @param DownloadManager $downloadManager
|
||||
|
@ -102,12 +100,12 @@ class Installer
|
|||
/**
|
||||
* Run installation (or update)
|
||||
*
|
||||
* @param bool $preferSource
|
||||
* @param bool $dryRun
|
||||
* @param bool $verbose
|
||||
* @param bool $noInstallRecommends
|
||||
* @param bool $installSuggests
|
||||
* @param bool $update
|
||||
* @param Boolean $preferSource
|
||||
* @param Boolean $dryRun
|
||||
* @param Boolean $verbose
|
||||
* @param Boolean $noInstallRecommends
|
||||
* @param Boolean $installSuggests
|
||||
* @param Boolean $update
|
||||
* @param RepositoryInterface $additionalInstalledRepository
|
||||
*/
|
||||
public function run($preferSource = false, $dryRun = false, $verbose = false, $noInstallRecommends = false, $installSuggests = false, $update = false, RepositoryInterface $additionalInstalledRepository = null)
|
||||
|
@ -202,8 +200,8 @@ class Installer
|
|||
}
|
||||
|
||||
// prepare solver
|
||||
$policy = new DefaultPolicy();
|
||||
$solver = new Solver($policy, $pool, $installedRepo);
|
||||
$policy = new DefaultPolicy();
|
||||
$solver = new Solver($policy, $pool, $installedRepo);
|
||||
|
||||
// solve dependencies
|
||||
$operations = $solver->solve($request);
|
||||
|
@ -316,14 +314,16 @@ class Installer
|
|||
|
||||
/**
|
||||
* Create Installer
|
||||
*
|
||||
*
|
||||
* @param IOInterface $io
|
||||
* @param Composer $composer
|
||||
* @param EventDispatcher $eventDispatcher
|
||||
* @return Installer
|
||||
*/
|
||||
static public function create(IOInterface $io, Composer $composer, EventDispatcher $eventDispatcher)
|
||||
static public function create(IOInterface $io, Composer $composer, EventDispatcher $eventDispatcher = null)
|
||||
{
|
||||
$eventDispatcher = $eventDispatcher ?: new EventDispatcher($composer, $io);
|
||||
|
||||
return new static(
|
||||
$io,
|
||||
$composer->getPackage(),
|
||||
|
|
Loading…
Reference in New Issue