当前位置: 首页>>代码示例>>PHP>>正文


PHP Composer::getEventDispatcher方法代码示例

本文整理汇总了PHP中Composer\Composer::getEventDispatcher方法的典型用法代码示例。如果您正苦于以下问题:PHP Composer::getEventDispatcher方法的具体用法?PHP Composer::getEventDispatcher怎么用?PHP Composer::getEventDispatcher使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Composer\Composer的用法示例。


在下文中一共展示了Composer::getEventDispatcher方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * @param string $baseDir Root directory of composer package.
  */
 public function __construct($baseDir)
 {
     $this->baseDir = $baseDir;
     $io = new NullIO();
     $this->composer = (new Factory())->createComposer($io, $baseDir . '/composer.json', true, $baseDir, false);
     $generator = new AutoloadGenerator($this->composer->getEventDispatcher(), $io);
     $generator->setDevMode(true);
     $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getPackages();
     $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $this->composer->getPackage(), $packages);
     $packageMap[0][1] = $baseDir;
     // To make root package paths absolute too.
     $autoloads = $generator->parseAutoloads($packageMap, $this->composer->getPackage());
     $this->classLoader = $generator->createLoader($autoloads);
 }
开发者ID:tsufeki,项目名称:phpcmplr,代码行数:17,代码来源:ComposerPackage.php

示例2: uninstall

 /**
  * @param array $packageNames
  *
  * @throws \RuntimeException
  */
 public function uninstall(array $packageNames)
 {
     $this->logger->info('Uninstalling begin', $packageNames);
     array_map(function ($name) {
         if (!$this->canBeDeleted($name)) {
             $errorMessage = sprintf('Package %s is not deletable', $name);
             $this->logger->error($errorMessage);
             throw new \RuntimeException($errorMessage);
         }
     }, $packageNames);
     $this->maintenance->activate();
     $this->removeFromComposerJson($packageNames);
     $installationManager = $this->composer->getInstallationManager();
     $localRepository = $this->getLocalRepository();
     $this->composer->getEventDispatcher()->dispatchCommandEvent('cache-clear', false);
     array_map(function ($name) use($installationManager, $localRepository) {
         $package = $this->findInstalledPackage($name);
         $this->scriptRunner->runUninstallScripts($package);
         $installationManager->uninstall($localRepository, new UninstallOperation($package));
     }, $packageNames);
     $this->scriptRunner->removeCachedFiles();
     $this->scriptRunner->clearApplicationCache();
     $this->scriptRunner->runPlatformUpdate();
     $this->scriptRunner->clearDistApplicationCache();
     $this->logger->info('Packages uninstalled', $packageNames);
 }
开发者ID:ramunasd,项目名称:platform,代码行数:31,代码来源:PackageManager.php

示例3: activate

 /**
  * Apply plugin modifications to composer
  *
  * @param Composer    $composer
  * @param IOInterface $io
  */
 public function activate(Composer $composer, IOInterface $io)
 {
     $this->composer = $composer;
     $this->io = $io;
     $this->eventDispatcher = $composer->getEventDispatcher();
     $this->executor = new ProcessExecutor($this->io);
     $this->patches = array();
 }
开发者ID:EurostarDigital,项目名称:composer-patches,代码行数:14,代码来源:Patches.php

示例4: __construct

 /**
  * @param \Composer\Package\PackageInterface $package
  * @param \Composer\Composer $composer
  */
 public function __construct(PackageInterface $package, Composer $composer)
 {
     parent::__construct($composer->getEventDispatcher());
     $this->_composer = $composer;
     $this->_autoloader = AssetsAutoloadGenerator::getInstance();
     $this->_autoloader->setGenerator(array($this, 'generate'));
     $this->_package = $package;
 }
开发者ID:atelierspierrot,项目名称:assets-manager,代码行数:12,代码来源:DumpAutoloadEventHandler.php

示例5: getComposer

 /**
  * Get a Composer object.
  *
  * @return \Composer\Composer
  */
 protected function getComposer()
 {
     if (!$this->composer) {
         // Set working directory
         chdir($this->getOption('basedir'));
         // Use the factory to get a new Composer object
         try {
             $this->composer = Factory::create($this->getIO(), $this->getOption('composerjson'), true);
             // Add the event subscriber
             $this->composer->getEventDispatcher()->addSubscriber($this->app['extend.listener']);
             if (!$this->app['extend.manager']->useSsl()) {
                 $this->setAllowSslDowngrade(true);
             }
         } catch (\Exception $e) {
             $this->app['logger.system']->critical($e->getMessage(), ['event' => 'exception', 'exception' => $e]);
         }
     }
     return $this->composer;
 }
开发者ID:MenZil-Team,项目名称:bolt,代码行数:24,代码来源:BaseAction.php

示例6: test_it_receives_event

    public function test_it_receives_event()
    {
        $this->composer->getPluginManager()->addPlugin(new ChangelogsPlugin());
        $initialPackage = new Package('foo/bar', '1.0.0.0', 'v1.0.0');
        $initialPackage->setSourceUrl('https://github.com/foo/bar.git');
        $targetPackage = new Package('foo/bar', '1.0.1.0', 'v1.0.1');
        $targetPackage->setSourceUrl('https://github.com/foo/bar.git');
        $operation = new UpdateOperation($initialPackage, $targetPackage);
        $this->composer->getEventDispatcher()->dispatchPackageEvent(PackageEvents::POST_PACKAGE_UPDATE, false, new DefaultPolicy(false, false), new Pool(), new CompositeRepository([]), new Request(new Pool()), [$operation], $operation);
        $this->composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_UPDATE_CMD);
        $expectedOutput = <<<OUTPUT
Changelogs summary:

 - foo/bar updated from v1.0.0 to v1.0.1
   See changes: https://github.com/foo/bar/compare/v1.0.0...v1.0.1
   Release notes: https://github.com/foo/bar/releases/tag/v1.0.1


OUTPUT;
        $this->assertSame($expectedOutput, $this->io->getOutput());
    }
开发者ID:e-tipalchuk,项目名称:composer-changelogs,代码行数:21,代码来源:ChangelogsPluginTest.php

示例7: getComposer

 /**
  * Get a Composer object.
  *
  * @throws \Exception
  *
  * @return \Composer\Composer
  */
 protected function getComposer()
 {
     if (!$this->composer) {
         // Set working directory
         chdir($this->getOptions()->baseDir());
         try {
             // Use the factory to get a new Composer object
             $this->composer = Factory::create($this->getIO(), $this->getOptions()->composerJson()->getPath(), false);
         } catch (\InvalidArgumentException $e) {
             throw new PackageManagerException($e->getMessage(), $e->getCode(), $e);
         } catch (\Exception $e) {
             $this->app['logger.system']->critical($e->getMessage(), ['event' => 'exception', 'exception' => $e]);
             throw $e;
         }
         // Add the event subscriber
         $this->composer->getEventDispatcher()->addSubscriber($this->app['extend.listener']);
         if (!$this->app['extend.manager']->useSsl()) {
             $this->setAllowSslDowngrade(true);
         }
     }
     return $this->composer;
 }
开发者ID:d-m-,项目名称:bolt,代码行数:29,代码来源:BaseAction.php

示例8: activate

 public function activate(Composer $composer, IOInterface $io)
 {
     $this->composer = $composer;
     $this->io = $io;
     // check if there already are scripts in .profile.d, or INI files (because we got invoked before), then calculate new starting point for file names
     foreach (['profileCounter' => (getenv('profile_dir_path') ?: '/dev/null') . '/[0-9][0-9][0-9]-*.sh', 'configCounter' => self::CONF_D_PATHNAME . '/[0-9][0-9][0-9]-*.ini'] as $var => $glob) {
         if ($matches = glob($glob)) {
             $this->{$var} = ceil(max(array_merge([$this->{$var}], array_map(function ($e) {
                 return explode('-', pathinfo($e, PATHINFO_FILENAME), 2)[0];
             }, $matches))) / 10) + 1;
         }
     }
     $composer->getDownloadManager()->setDownloader('heroku-sys-tar', new Downloader($io, $composer->getConfig(), $composer->getEventDispatcher()));
     $composer->getInstallationManager()->addInstaller(new ComposerInstaller($io, $composer));
 }
开发者ID:Arch1js,项目名称:Westcombe-Engineering-MRP-system,代码行数:15,代码来源:ComposerInstallerPlugin.php

示例9: activate

 /**
  * {@inheritdoc}
  */
 public function activate(Composer $composer, IOInterface $io)
 {
     if (!$this->puliRunner) {
         try {
             // Add Composer's bin directory in case the "puli" executable is
             // installed with Composer
             $this->puliRunner = new PuliRunner($composer->getConfig()->get('bin-dir'));
         } catch (RuntimeException $e) {
             $io->writeError('<warn>' . $e->getMessage() . '</warn>');
             // Don't activate the plugin if Puli cannot be run
             return;
         }
     }
     $composer->getEventDispatcher()->addSubscriber($this);
 }
开发者ID:niklongstone,项目名称:composer-plugin,代码行数:18,代码来源:PuliPlugin.php

示例10: activate

 /**
  * Set hoa\core require in last position.
  *
  * @param Composer    $composer composer
  * @param IOInterface $io       io
  */
 public function activate(Composer $composer, IOInterface $io)
 {
     $composer->setAutoloadGenerator(new AutoloadGenerator($composer->getEventDispatcher()));
 }
开发者ID:rezzza,项目名称:composer-hoa-plugin,代码行数:10,代码来源:HoaPlugin.php

示例11: activate

 /**
  * {@inheritdoc}
  */
 public function activate(Composer $composer, IOInterface $io)
 {
     $composer->getEventDispatcher()->addSubscriber($this);
 }
开发者ID:issei-m,项目名称:composer-plugin,代码行数:7,代码来源:PuliPlugin.php

示例12: activate

 /**
  * @inheritdoc
  */
 public function activate(Composer $composer, IOInterface $io)
 {
     $installer = new Installer();
     $composer->getEventDispatcher()->addSubscriber($installer);
 }
开发者ID:deesoft,项目名称:yii2-composer,代码行数:8,代码来源:Plugin.php

示例13: activate

 public function activate(Composer $composer, IOInterface $io)
 {
     $composer->getDownloadManager()->setDownloader('heroku-sys-tar', new Downloader($io, $composer->getConfig(), $composer->getEventDispatcher()));
     $composer->getInstallationManager()->addInstaller(new ComposerInstaller($io, $composer));
 }
开发者ID:codefoco,项目名称:heroku-buildpack-php,代码行数:5,代码来源:ComposerInstallerPlugin.php

示例14: create

 /**
  * Create Installer
  *
  * @param  IOInterface $io
  * @param  Composer    $composer
  * @return Installer
  */
 public static function create(IOInterface $io, Composer $composer)
 {
     return new static($io, $composer->getConfig(), $composer->getPackage(), $composer->getDownloadManager(), $composer->getRepositoryManager(), $composer->getLocker(), $composer->getInstallationManager(), $composer->getEventDispatcher(), $composer->getAutoloadGenerator());
 }
开发者ID:Flesh192,项目名称:magento,代码行数:11,代码来源:Installer.php

示例15: activate

 /**
  * Apply plugin modifications to Composer
  *
  * @param Composer    $composer
  * @param IOInterface $io
  */
 public function activate(Composer $composer, IOInterface $io)
 {
     $this->composer = $composer;
     $this->generator = new AutoloadGenerator($composer->getEventDispatcher(), $io);
 }
开发者ID:funkjedi,项目名称:composer-include-files,代码行数:11,代码来源:Plugin.php


注:本文中的Composer\Composer::getEventDispatcher方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。