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


PHP Config::has方法代码示例

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


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

示例1: 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

示例2: setupConfig

 protected function setupConfig($config = null) {
     if (!$config) {
         $config = new Config();
     }
     if (!$config->has('home')) {
         $tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'cmptest-'.md5(uniqid('', true));
         $config->merge(array('config' => array('home' => $tmpDir)));
     }
     return $config;
 }
开发者ID:Rudloff,项目名称:composer,代码行数:10,代码来源:GitDownloaderTest.php

示例3: createAuthFromConfig

 /**
  * Create the auth params from the configuration file.
  *
  * @return bool
  */
 private function createAuthFromConfig()
 {
     if (!$this->config->has('http-basic')) {
         return $this->hasAuth = false;
     }
     $authConfig = $this->config->get('http-basic');
     $host = parse_url($this->url, PHP_URL_HOST);
     if (isset($authConfig[$host])) {
         $this->credentials['username'] = $authConfig[$host]['username'];
         $this->credentials['password'] = $authConfig[$host]['password'];
         return $this->hasAuth = true;
     }
     return $this->hasAuth = false;
 }
开发者ID:alancleaver,项目名称:composer,代码行数:19,代码来源:Svn.php


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