本文整理汇总了PHP中Composer\Composer::getDownloadManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Composer::getDownloadManager方法的具体用法?PHP Composer::getDownloadManager怎么用?PHP Composer::getDownloadManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Composer\Composer
的用法示例。
在下文中一共展示了Composer::getDownloadManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Initializes library installer.
*
* @param IOInterface $io
* @param Composer $composer
* @param Filesystem $filesystem
*/
public function __construct(IOInterface $io, Composer $composer, Filesystem $filesystem = null)
{
$this->composer = $composer;
$this->downloadManager = $composer->getDownloadManager();
$this->io = $io;
$this->filesystem = $filesystem ?: new Filesystem();
}
示例2: testSetGetDownloadManager
public function testSetGetDownloadManager()
{
$composer = new Composer();
$manager = $this->getMock('Composer\\Downloader\\DownloadManager');
$composer->setDownloadManager($manager);
$this->assertSame($manager, $composer->getDownloadManager());
}
示例3: updateComposer
/**
* @param bool $reload
*
* @return int
*/
protected function updateComposer($reload = false)
{
if ($reload) {
$this->composer = Factory::create($this->io, null, $this->disablePluginsByDefault);
}
ini_set('memory_limit', '1024M');
$this->composer->getDownloadManager()->setOutputProgress(true);
$install = Installer::create($this->io, $this->composer);
$config = $this->composer->getConfig();
$preferSource = false;
$preferDist = true;
switch ($config->get('preferred-install')) {
case 'source':
$preferSource = true;
break;
case 'dist':
$preferDist = true;
break;
case 'auto':
default:
break;
}
$optimize = $config->get('optimize-autoloader');
$authoritative = $config->get('classmap-authoritative');
$install->setPreferSource($preferSource);
$install->setPreferDist($preferDist);
$install->setDevMode(true);
$install->setDumpAutoloader(true);
$install->setOptimizeAutoloader(true);
$install->setUpdate(true);
return $install->run();
}
示例4: activate
/**
* @inheritdoc
*/
public function activate(Composer $composer, IOInterface $io)
{
$this->io = $io;
//Extend download manager
$dm = $composer->getDownloadManager();
$executor = new ProcessExecutor($io);
$fs = new Filesystem($executor);
$config = $composer->getConfig();
$dm->setDownloader('svn-export', new Downloader($io, $config, $executor, $fs));
//Extend RepositoryManager Classes
$rm = $composer->getRepositoryManager();
$rm->setRepositoryClass('svn-export', 'LinearSoft\\Composer\\SvnExport\\Repository\\VcsRepository');
$rm->setRepositoryClass('svn-export-composer', 'LinearSoft\\Composer\\SvnExport\\Repository\\ComposerRepository');
//Load Extra Data
$extra = $composer->getPackage()->getExtra();
if (isset($extra['svn-export-repositories']) && is_array($extra['svn-export-repositories'])) {
foreach ($extra['svn-export-repositories'] as $index => $repoConfig) {
$this->validateRepositories($index, $repoConfig);
if (isset($repoConfig['name'])) {
$name = $repoConfig['name'];
} else {
$name = is_int($index) ? preg_replace('{^https?://}i', '', $repoConfig['url']) : $index;
}
if ($repoConfig['type'] === 'svn') {
$repoConfig['type'] = 'svn-export';
} else {
$repoConfig['type'] = 'svn-export-composer';
}
$repo = $rm->createRepository($repoConfig['type'], $repoConfig);
$rm->addRepository($repo);
$this->io->write("Added SvnExport repo: {$name}");
}
}
}
示例5: __construct
/**
* @param \Composer\Composer $composer
* @param \Composer\Util\Filesystem $filesystem
*/
public function __construct(\Composer\Composer $composer, \Composer\Util\Filesystem $filesystem = NULL)
{
$this->composer = $composer;
$this->downloadManager = $composer->getDownloadManager();
$this->filesystem = $filesystem ?: new \Composer\Util\Filesystem();
$this->extensionDir = self::TYPO3_CONF_DIR . DIRECTORY_SEPARATOR . self::TYPO3_EXT_DIR;
}
示例6: __construct
/**
* @param \Composer\Composer $composer
* @param Filesystem $filesystem
*/
public function __construct(\Composer\Composer $composer, Filesystem $filesystem, CoreInstaller\GetTypo3OrgService $getTypo3OrgService)
{
$this->composer = $composer;
$this->downloadManager = $composer->getDownloadManager();
$this->filesystem = $filesystem;
$this->getTypo3OrgService = $getTypo3OrgService;
$this->symlinks = array(self::TYPO3_SRC_DIR . DIRECTORY_SEPARATOR . self::TYPO3_INDEX_PHP => self::TYPO3_INDEX_PHP, self::TYPO3_SRC_DIR . DIRECTORY_SEPARATOR . self::TYPO3_DIR => self::TYPO3_DIR);
}
示例7: __construct
/**
* @param \Composer\Composer $composer
* @param Filesystem $filesystem
*/
public function __construct(\Composer\Composer $composer, Filesystem $filesystem)
{
$this->composer = $composer;
$this->downloadManager = $composer->getDownloadManager();
$this->filesystem = $filesystem;
$this->initializeConfiguration();
$this->initializeSymlinks();
}
示例8: __construct
/**
* @param \Composer\Composer $composer
* @param \Composer\Util\Filesystem $filesystem
*/
public function __construct(\Composer\Composer $composer, \Composer\Util\Filesystem $filesystem = NULL)
{
$this->composer = $composer;
$this->downloadManager = $composer->getDownloadManager();
$this->filesystem = $filesystem ?: new \Composer\Util\Filesystem();
$this->initializeConfiguration();
$this->initializeExtensionDir();
}
示例9: testSetGetDownloadManager
public function testSetGetDownloadManager()
{
$composer = new Composer();
$io = $this->getMock('Composer\\IO\\IOInterface');
$manager = $this->getMock('Composer\\Downloader\\DownloadManager', array(), array($io));
$composer->setDownloadManager($manager);
$this->assertSame($manager, $composer->getDownloadManager());
}
示例10: __construct
/**
* @param \Composer\Composer $composer
* @param Filesystem $filesystem
*/
public function __construct(\Composer\Composer $composer, Filesystem $filesystem, CoreInstaller\GetTypo3OrgService $getTypo3OrgService)
{
$this->composer = $composer;
$this->downloadManager = $composer->getDownloadManager();
$this->filesystem = $filesystem;
$this->getTypo3OrgService = $getTypo3OrgService;
$this->initializeConfiguration();
$this->initializeSymlinks();
}
示例11: initMultiVcsRepositories
/**
* Init multi VCS repository
*
* @param Composer $composer
* @param IOInterface $io
* @return $this
*/
protected function initMultiVcsRepositories(Composer $composer, IOInterface $io)
{
$repoDownloader = new GitMultiRepoDownloader($io, $composer->getConfig());
foreach ($this->getVcsTypes() as $type) {
$composer->getDownloadManager()->setDownloader($type, $repoDownloader);
$composer->getRepositoryManager()->setRepositoryClass($type, $this->getMultiRepositoryClassName());
}
return $this;
}
示例12: __construct
/**
* Initializes library installer.
*
* @param IOInterface $io
* @param Composer $composer
* @param string $type
* @param Filesystem $filesystem
* @param BinaryInstaller $binaryInstaller
*/
public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
{
$this->composer = $composer;
$this->downloadManager = $composer->getDownloadManager();
$this->io = $io;
$this->type = $type;
$this->filesystem = $filesystem ?: new Filesystem();
$this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
$this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem);
}
示例13: __construct
/**
* Initializes library installer.
*
* @param IOInterface $io
* @param Composer $composer
* @param string $type
*/
public function __construct(IOInterface $io, Composer $composer, $type = 'library')
{
$this->composer = $composer;
$this->downloadManager = $composer->getDownloadManager();
$this->io = $io;
$this->type = $type;
$this->filesystem = new Filesystem();
$this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
$this->binDir = rtrim($composer->getConfig()->get('bin-dir'), '/');
}
示例14: activate
/**
* @param Composer $composer
* @param IOInterface $io
*/
public function activate(Composer $composer, IOInterface $io)
{
$dm = $composer->getDownloadManager();
// yes, it is bad
$r = new \ReflectionObject($dm);
$property = $r->getProperty('downloaders');
$property->setAccessible(true);
$downloaders = $property->getValue($dm);
$downloaders['git'] = new \Sonata\Composer\Downloader\GitDownloader($io, $composer->getConfig());
$property->setValue($dm, $downloaders);
}
示例15: activate
/**
* {@inheritDoc}
*/
public function activate(Composer $composer, IOInterface $io)
{
$filesystem = new Filesystem();
$composer->getInstallationManager()->addInstaller(new CoreInstaller($composer, $filesystem, new CoreInstaller\GetTypo3OrgService($io)));
$composer->getInstallationManager()->addInstaller(new ExtensionInstaller($composer, $filesystem));
$cache = null;
if ($composer->getConfig()->get('cache-files-ttl') > 0) {
$cache = new Cache($io, $composer->getConfig()->get('cache-files-dir'), 'a-z0-9_./');
}
$composer->getDownloadManager()->setDownloader('t3x', new Downloader\T3xDownloader($io, $composer->getConfig(), null, $cache));
}