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


PHP PackageInterface::setExtra方法代码示例

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


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

示例1: setInstallerName

 /**
  * Set installer-name based on namespace for the source path checking in
  * following order:
  *
  * - With only one autoload path the namespace for that path will be used.
  * - With multiple paths if path 'src' exists it's namespace will be used.
  * - With two autoload paths provided, the namespace of path other than
  *   'tests' will be used.
  *
  * No installer-name is set if PSR-4 autoload block is not found or if none
  * of the above conditions are met.
  *
  * @param PackageInterface $package
  */
 protected function setInstallerName(PackageInterface $package)
 {
     $primaryNS = null;
     $autoLoad = $package->getAutoload();
     foreach ($autoLoad as $type => $typeConfig) {
         if ($type !== 'psr-4') {
             continue;
         }
         $count = count($typeConfig);
         if ($count === 1) {
             $primaryNS = key($typeConfig);
             break;
         }
         $matches = preg_grep('#^(\\./)?src/?$#', $typeConfig);
         if ($matches) {
             $primaryNS = key($matches);
             break;
         }
         if ($count === 2) {
             reset($typeConfig);
             if (preg_match('#^(\\./)?tests/?$#', current($typeConfig))) {
                 next($typeConfig);
             }
             $primaryNS = key($typeConfig);
             break;
         }
         break;
     }
     if ($primaryNS) {
         $package->setExtra(array('installer-name' => trim(str_replace('\\', '/', $primaryNS), '/')));
     }
 }
开发者ID:nooshin-mirzadeh,项目名称:web_2.0_benchmark,代码行数:46,代码来源:CakePHPInstaller.php

示例2: setInstallerName

 /**
  * Set installer-name based on namespace for the source path
  *
  * With one autoload path this will be used as installer-name.
  * With two autoload paths the first non `tests` foldername will be set.
  * If more then 2 autoload paths are provided, installer-name will only be
  * set for if `src` folder is used.
  *
  * @param PackageInterface $package
  */
 protected function setInstallerName(PackageInterface $package)
 {
     $autoLoad = $package->getAutoload();
     foreach ($autoLoad as $type => $typeConfig) {
         if ($type !== 'psr-4') {
             continue;
         }
         $count = count($typeConfig);
         foreach ($typeConfig as $namespace => $path) {
             if ($path === 'tests') {
                 continue;
             }
             if ($count > 2 && $path !== 'src') {
                 continue;
             }
             $installerName = trim(str_replace('\\', '/', $namespace), '/');
             $package->setExtra(array('installer-name' => $installerName));
         }
         break;
     }
 }
开发者ID:grBro,项目名称:taskmanager,代码行数:31,代码来源:CakePHPInstaller.php

示例3: addMainFiles

 /**
  * Adds the main file definitions from the root package.
  *
  * @param Composer         $composer
  * @param PackageInterface $package
  * @param string           $section
  */
 public static function addMainFiles(Composer $composer, PackageInterface $package, $section = 'asset-main-files')
 {
     if ($package instanceof \Composer\Package\Package) {
         $packageExtra = $package->getExtra();
         $extra = $composer->getPackage()->getExtra();
         if (isset($extra[$section])) {
             foreach ($extra[$section] as $packageName => $files) {
                 if ($packageName === $package->getName()) {
                     $packageExtra['bower-asset-main'] = $files;
                     break;
                 }
             }
         }
         $package->setExtra($packageExtra);
     }
     return $package;
 }
开发者ID:MvegaR,项目名称:ingSotfware,代码行数:24,代码来源:AssetPlugin.php


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