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


PHP Composer::getConfig方法代码示例

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


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

示例1: __construct

 public function __construct(IOInterface $io, Composer $composer, $type = null)
 {
     if ($composer->getConfig()->has('composer-global-installer')) {
         $this->_isInUse = true;
         $this->_config = $composer->getConfig()->get('composer-global-installer');
         if (isset($this->_config['vendor-global-dir'])) {
             $this->_globalDir = $this->_config['vendor-global-dir'];
         }
         if (isset($this->_config['vendor-global-types'])) {
             // Bad format, use default
             // @todo throw exception
             if (is_array($this->_config['vendor-global-types'])) {
                 $this->_supportedTypes = $this->_config['vendor-global-types'];
             }
         }
         if ($composer->getConfig()->has('vendor-global-packages')) {
             // Bad format, use default
             // @todo throw exception
             if (is_array($composer->getConfig()->get('vendor-global-packages'))) {
                 $this->_globalPackages = $composer->getConfig()->get('vendor-global-packages');
             }
         }
     }
     parent::__construct($io, $composer, $type);
 }
开发者ID:itscaro,项目名称:composer-global-installer,代码行数:25,代码来源:GlobalInstaller.php

示例2: processCopy

 public function processCopy(array $config)
 {
     $config = $this->processConfig($config);
     $project_path = \realpath($this->composer->getConfig()->get('vendor-dir') . '/../') . '/';
     $debug = $config['debug'];
     if ($debug) {
         $this->io->write('[sasedev/composer-plugin-filecopier] basepath : ' . $project_path);
     }
     $destination = $config['destination'];
     if (\strlen($destination) == 0 || \strlen($destination) != 0 && !$this->startsWith($destination, '/')) {
         $destination = $project_path . $destination;
     }
     if (false === \realpath($destination)) {
         mkdir($destination, 0755, true);
     }
     $destination = \realpath($destination);
     $source = $config['source'];
     if ($debug) {
         $this->io->write('[sasedev/composer-plugin-filecopier] init source : ' . $source);
         $this->io->write('[sasedev/composer-plugin-filecopier] init destination : ' . $destination);
     }
     $sources = \glob($source, GLOB_MARK);
     if (!empty($sources)) {
         foreach ($sources as $newsource) {
             $this->copyr($newsource, $destination, $project_path, $debug);
         }
     }
 }
开发者ID:sasedev,项目名称:composer-plugin-filecopier,代码行数:28,代码来源:Processor.php

示例3: changeDirectory

 public function changeDirectory($cwd)
 {
     $this->cwd = realpath($cwd);
     if (!$this->cwd) {
         throw new Exception($cwd . 'doesn\'t exist');
     }
     $this->vendorDir = rtrim($this->cwd . '/' . $this->composer->getConfig()->get('vendor-dir'), '/');
 }
开发者ID:netresearch,项目名称:composer-installers,代码行数:8,代码来源:CoreInstallerAbstract.php

示例4: activate

 public function activate(Composer $composer, IOInterface $io)
 {
     $this->composer = $composer;
     $this->io = $io;
     $this->fs = new FileSystem();
     $this->process = new ProcessExecutor($this->io);
     $this->config = $this->composer->getConfig();
 }
开发者ID:vbuilder,项目名称:composer-plugin,代码行数:8,代码来源:Plugin.php

示例5: registerStudioPackages

 /**
  * Register all managed paths with Composer.
  *
  * This function configures Composer to treat all Studio-managed paths as local path repositories, so that packages
  * therein will be symlinked directly.
  */
 public function registerStudioPackages()
 {
     $repoManager = $this->composer->getRepositoryManager();
     $composerConfig = $this->composer->getConfig();
     foreach ($this->getManagedPaths() as $path) {
         $this->io->writeError("[Studio] Loading path {$path}");
         $repoManager->prependRepository(new PathRepository(['url' => $path], $this->io, $composerConfig));
     }
 }
开发者ID:franzliedke,项目名称:studio,代码行数:15,代码来源:StudioPlugin.php

示例6: prePackage

 /**
  * Pre Package event behaviour for backing up preserved paths.
  *
  * @param \Composer\Script\PackageEvent $event
  */
 public function prePackage(PackageEvent $event)
 {
     $packages = $this->getPackagesFromEvent($event);
     $paths = $this->getInstallPathsFromPackages($packages);
     $preserver = new PathPreserver($paths, $this->getPreservePaths(), $this->composer->getConfig()->get('cache-dir'), $this->filesystem, $this->io);
     // Store preserver for reuse in post package.
     $this->preservers[$this->getUniqueNameFromPackages($packages)] = $preserver;
     $preserver->preserve();
 }
开发者ID:derhasi,项目名称:composer-preserve-paths,代码行数:14,代码来源:PluginWrapper.php

示例7: activate

 /**
  * {@inheritdoc}
  */
 public function activate(Composer $composer, IOInterface $io)
 {
     $extra = $composer->getPackage()->getExtra();
     $this->moduleContainer = new ModuleContainer($extra[static::COMPOSER_CONFIG_KEY_EXTRA]['path'], $extra[static::COMPOSER_CONFIG_KEY_EXTRA]['filename']);
     $this->finder = new Finder();
     $this->parser = new RegisterFileParser();
     $this->manipulator = new AutoloadManipulator($composer->getConfig()->get('vendor-dir'));
     $this->dumper = new AutoloadDumper($composer->getConfig()->get('vendor-dir'), new ArrayToText());
 }
开发者ID:christophe-chausseray,项目名称:autoregister-classmap-plugin,代码行数:12,代码来源:AutoregisterClassmapPlugin.php

示例8: __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'), '/');
 }
开发者ID:nickelc,项目名称:composer,代码行数:17,代码来源:LibraryInstaller.php

示例9: __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);
 }
开发者ID:radykal-com,项目名称:composer,代码行数:19,代码来源:LibraryInstaller.php

示例10: 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));
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:14,代码来源:Plugin.php

示例11: onPreFileDownload

 public function onPreFileDownload(PreFileDownloadEvent $event)
 {
     $url = $event->getProcessedUrl();
     $host = parse_url($url, PHP_URL_HOST);
     $protocol = parse_url($url, PHP_URL_SCHEME);
     if (in_array($host, $this->hosts, true) && ($protocol === 'http' || $protocol === 'https')) {
         $orig = $event->getRemoteFilesystem();
         $curl = new CurlRemoteFilesystem($this->curlClient, $this->io, $this->composer->getConfig(), $orig->getOptions());
         $event->setRemoteFilesystem($curl);
     }
 }
开发者ID:ngyuki,项目名称:composer-curl-plugin,代码行数:11,代码来源:Plugin.php

示例12: postAutoloadDump

 public function postAutoloadDump(Event $event)
 {
     // This method is called twice. Run it only once.
     if (!$this->runPostAutoloadDump) {
         return;
     }
     $this->runPostAutoloadDump = false;
     $config = $this->composer->getConfig();
     $suffix = $config->get('autoloader-suffix');
     $vendorDir = $config->get('vendor-dir');
     $binDir = $config->get('bin-dir');
     $autoloadFile = $vendorDir . '/autoload.php';
     if (!file_exists($autoloadFile)) {
         throw new \RuntimeException(sprintf('Could not adjust autoloader: The file %s was not found.', $autoloadFile));
     }
     if (!$suffix && !$config->get('autoloader-suffix') && is_readable($autoloadFile)) {
         $content = file_get_contents($vendorDir . '/autoload.php');
         if (preg_match('{' . self::COMPOSER_AUTOLOADER_BASE . '([^:\\s]+)::}', $content, $match)) {
             $suffix = $match[1];
         }
     }
     $contents = file_get_contents($autoloadFile);
     $constant = '';
     $values = array('AUTOLOAD_CLASS' => var_export(self::COMPOSER_AUTOLOADER_BASE . $suffix, true));
     foreach ($values as $key => $value) {
         $this->io->write('<info>Generating ' . $this->constantPrefix . $key . ' constant</info>');
         $constant .= "if (!defined('{$this->constantPrefix}{$key}')) {\n";
         $constant .= sprintf("    define('{$this->constantPrefix}{$key}', %s);\n", $value);
         $constant .= "}\n\n";
     }
     $values = array_map(function ($value) {
         return var_export($value, true);
     }, array('BASE_DIR' => Path::makeRelative(getcwd(), $vendorDir), 'BIN_DIR' => Path::makeRelative($binDir, $vendorDir), 'FILE' => Path::makeRelative(realpath(Factory::getComposerFile()), $vendorDir)));
     foreach ($values as $key => $value) {
         $this->io->write('<info>Generating ' . $this->constantPrefix . $key . ' constant</info>');
         $constant .= "if (!defined('{$this->constantPrefix}{$key}')) {\n";
         $constant .= sprintf("    define('{$this->constantPrefix}{$key}', realpath(__DIR__ . DIRECTORY_SEPARATOR . %s));\n", $value);
         $constant .= "}\n\n";
     }
     $values = array('VENDOR_DIR' => $vendorDir);
     foreach ($values as $key => $value) {
         $this->io->write('<info>Generating ' . $this->constantPrefix . $key . ' constant</info>');
         $constant .= "if (!defined('{$this->constantPrefix}{$key}')) {\n";
         $constant .= sprintf("    define('{$this->constantPrefix}{$key}', realpath(__DIR__));\n");
         $constant .= "}\n\n";
     }
     // Regex modifiers:
     // "m": \s matches newlines
     // "D": $ matches at EOF only
     // Translation: insert before the last "return" in the file
     $contents = preg_replace('/\\n(?=return [^;]+;\\s*$)/mD', "\n" . $constant, $contents);
     file_put_contents($autoloadFile, $contents);
 }
开发者ID:bangpound,项目名称:composer-constants,代码行数:53,代码来源:ConstantsPlugin.php

示例13: activate

 /**
  * Apply plugin modifications to Composer
  *
  * @param Composer $composer
  * @param IOInterface $io
  */
 public function activate(Composer $composer, IOInterface $io)
 {
     $this->io = $io;
     $this->composer = $composer;
     $rootDir = realpath($this->composer->getConfig()->get('vendor-dir') . '/../');
     $settings = $this->composer->getPackage()->getExtra()['application'] ?? [];
     $this->appInfo = new AppInfo($rootDir, $settings);
     $this->componentInstaller = new ComponentInstaller($this->appInfo, $io, $composer);
     $this->assetsInstaller = new AssetsInstaller($this->appInfo, $io, $composer);
     $manager = $this->composer->getInstallationManager();
     $manager->addInstaller($this->componentInstaller);
     $manager->addInstaller($this->assetsInstaller);
 }
开发者ID:opis,项目名称:colibri,代码行数:19,代码来源:Plugin.php

示例14: activate

 public function activate(Composer $composer, IOInterface $io)
 {
     if ($package = $composer->getPackage()) {
         $this->setConfig(Config::createFromPackage($package));
     }
     $repo = new CompositeRepository(array(new WordPressCoreRepository($io, $composer->getConfig()), new WordPressThemeRepository($io, $composer->getConfig()), new WordPressPluginRepository($io, $composer->getConfig())));
     $composer->getRepositoryManager()->addRepository($repo);
     $im = $composer->getInstallationManager();
     $im->addInstaller(new CoreInstaller($io, $composer, $this));
     $im->addInstaller(new ThemeInstaller($io, $composer, $this));
     $im->addInstaller(new PluginInstaller($io, $composer, $this));
     $im->addInstaller(new MuPluginInstaller($io, $composer, $this));
 }
开发者ID:fancyguy,项目名称:composer-wordpress-plugin,代码行数:13,代码来源:WordPressPlugin.php

示例15: init

 /**
  * {@inheritdoc}
  */
 public function init()
 {
     // Retrieve the configuration variables.
     $this->config = $this->composer->getConfig();
     if (isset($this->config)) {
         if ($this->config->has('component-dir')) {
             $this->componentDir = $this->config->get('component-dir');
         }
     }
     // Get the available packages.
     $allPackages = array();
     /** @var \Composer\Package\Locker $locker */
     $locker = $this->composer->getLocker();
     if ($locker !== null && $locker->isLocked()) {
         $lockData = $locker->getLockData();
         $allPackages = $lockData['packages'];
         // Also merge in any of the development packages.
         $dev = isset($lockData['packages-dev']) ? $lockData['packages-dev'] : array();
         foreach ($dev as $package) {
             $allPackages[] = $package;
         }
     }
     // Only add those packages that we can reasonably
     // assume are components into our packages list
     /** @var \Composer\Package\RootPackageInterface $rootPackage */
     $rootPackage = $this->composer->getPackage();
     $rootExtras = $rootPackage ? $rootPackage->getExtra() : array();
     $customComponents = isset($rootExtras['component']) ? $rootExtras['component'] : array();
     foreach ($allPackages as $package) {
         $name = $package['name'];
         if (isset($customComponents[$name]) && is_array($customComponents[$name])) {
             $package['extra'] = array('component' => $customComponents[$name]);
             $this->packages[] = $package;
         } else {
             $extra = isset($package['extra']) ? $package['extra'] : array();
             if (isset($extra['component']) && is_array($extra['component'])) {
                 $this->packages[] = $package;
             }
         }
     }
     // Add the root package to the packages list.
     $root = $this->composer->getPackage();
     if ($root) {
         $dumper = new ArrayDumper();
         $package = $dumper->dump($root);
         $package['is-root'] = true;
         $this->packages[] = $package;
     }
     return true;
 }
开发者ID:robloach,项目名称:component-installer,代码行数:53,代码来源:Process.php


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