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


PHP PackageInterface::getExtra方法代码示例

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


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

示例1: getMap

 /**
  * Retrieve map
  *
  * @return array
  */
 protected function getMap()
 {
     if ($this->map == null) {
         $this->map = [];
         $extra = $this->package->getExtra();
         if (array_key_exists('map', $extra)) {
             $this->map = $extra['map'];
         }
     }
     return $this->map;
 }
开发者ID:addictedtomagento,项目名称:magento2-composer-installer,代码行数:16,代码来源:BaseDeployment.php

示例2: getPackageName

 /**
  * @param PackageInterface $package
  *
  * @return string
  * @throws Exception
  */
 private function getPackageName(PackageInterface $package)
 {
     if (is_array($package->getExtra()) && isset($package->getExtra()['installer-name'])) {
         return $package->getExtra()['installer-name'];
     }
     $name = explode('/', $package->getPrettyName());
     $packageName = $name[1];
     if (count(explode('-', $packageName)) < 2) {
         throw new Exception('Bundle names should be like "vendor/NAME-bundle"');
     }
     $packageName = str_replace('-bundle', '', $packageName);
     return str_replace(' ', '', ucwords(str_replace('-', ' ', $packageName)));
 }
开发者ID:radphp,项目名称:composer-installer,代码行数:19,代码来源:BundleInstaller.php

示例3: getInstallPath

 /**
  * {@inheritDoc}
  */
 public function getInstallPath(PackageInterface $package)
 {
     /**
      * Set install path from root
      */
     $path = $this->getRootInstallPath();
     /**
      * Set install path via package
      */
     if (!$path && $package->getExtra()) {
         $path = $this->getInstallPathFromExtra($package->getExtra());
     }
     $this->recordInstallPath($package, $path);
     return $path;
 }
开发者ID:aaemnnosttv,项目名称:wordpress-tests-core-installer,代码行数:18,代码来源:WordPressTestsCoreInstaller.php

示例4: getPackageInstallPath

 public static function getPackageInstallPath(PackageInterface $package, Composer $composer)
 {
     $prettyName = $package->getPrettyName();
     if (strpos($prettyName, '/') !== false) {
         list($vendor, $name) = explode('/', $prettyName);
     } else {
         $vendor = '';
         $name = $prettyName;
     }
     $availableVars = compact('name', 'vendor');
     $extra = $package->getExtra();
     if (!empty($extra['installer-name'])) {
         $availableVars['name'] = $extra['installer-name'];
     }
     if ($composer->getPackage()) {
         $extra = $composer->getPackage()->getExtra();
         if (!empty($extra['installer-paths'])) {
             $customPath = self::mapCustomInstallPaths($extra['installer-paths'], $prettyName);
             if (false !== $customPath) {
                 return self::templatePath($customPath, $availableVars);
             }
         }
     }
     return NULL;
 }
开发者ID:mnsami,项目名称:composer-custom-directory-installer,代码行数:25,代码来源:PackageUtils.php

示例5: getInstallPath

 /**
  * {@inheritDoc}
  */
 public function getInstallPath(PackageInterface $package)
 {
     $installationDir = false;
     $prettyName = $package->getPrettyName();
     if ($this->composer->getPackage()) {
         $topExtra = $this->composer->getPackage()->getExtra();
         if (!empty($topExtra['wordpress-install-dir'])) {
             $installationDir = $topExtra['wordpress-install-dir'];
             if (is_array($installationDir)) {
                 $installationDir = empty($installationDir[$prettyName]) ? false : $installationDir[$prettyName];
             }
         }
     }
     $extra = $package->getExtra();
     if (!$installationDir && !empty($extra['wordpress-install-dir'])) {
         $installationDir = $extra['wordpress-install-dir'];
     }
     if (!$installationDir) {
         $installationDir = 'wordpress';
     }
     if (!empty(self::$_installedPaths[$installationDir]) && $prettyName !== self::$_installedPaths[$installationDir]) {
         throw new \InvalidArgumentException('Two packages cannot share the same directory!');
     }
     self::$_installedPaths[$installationDir] = $prettyName;
     return $installationDir;
 }
开发者ID:UNGI-Shu,项目名称:Test,代码行数:29,代码来源:WordPressCoreInstaller.php

示例6: getInstallPath

 /**
  * Return the install path based on package type.
  *
  * @param  PackageInterface $package
  * @param  string           $frameworkType
  * @return string
  */
 public function getInstallPath(PackageInterface $package, $frameworkType = '')
 {
     $type = $this->package->getType();
     $prettyName = $this->package->getPrettyName();
     if (strpos($prettyName, '/') !== false) {
         list($vendor, $name) = explode('/', $prettyName);
     } else {
         $vendor = '';
         $name = $prettyName;
     }
     $availableVars = $this->inflectPackageVars(compact('name', 'vendor', 'type'));
     $extra = $package->getExtra();
     if (!empty($extra['installer-name'])) {
         $availableVars['name'] = $extra['installer-name'];
     }
     if ($this->composer->getPackage()) {
         $extra = $this->composer->getPackage()->getExtra();
         if (!empty($extra['installer-paths'])) {
             $customPath = $this->mapCustomInstallPaths($extra['installer-paths'], $prettyName, $type);
             if ($customPath !== false) {
                 return $this->templatePath($customPath, $availableVars);
             }
         }
     }
     $packageType = substr($type, strlen($frameworkType) + 1);
     $locations = $this->getLocations();
     if (!isset($locations[$packageType])) {
         throw new \InvalidArgumentException(sprintf('Package type "%s" is not supported', $type));
     }
     return $this->templatePath($locations[$packageType], $availableVars);
 }
开发者ID:SebFav,项目名称:ApplicationInternet2,代码行数:38,代码来源:BaseInstaller.php

示例7: getInstallPath

 /**
  * Provides installation path for package. Kudos go to
  * https://github.com/johnpbloch/wordpress-core-installer
  *
  * @param PackageInterface $package Installed package.
  *
  * @todo refactor
  *
  * @return string
  * @since 0.1.0
  */
 public function getInstallPath(PackageInterface $package)
 {
     $prettyName = $package->getPrettyName();
     DebugPrinter::log('Getting install path for `%s` package', array($prettyName));
     if (isset($this->installDirCache[$prettyName])) {
         return $this->installDirCache[$prettyName];
     }
     $installDir = null;
     if ($this->composer->getPackage()) {
         $rootExtra = $this->composer->getPackage()->getExtra();
         if (!empty($rootExtra['opencart-install-dir'])) {
             $installDir = $rootExtra['opencart-install-dir'];
         }
     }
     if (!$installDir) {
         $extra = $package->getExtra();
         if (!empty($extra['opencart-install-dir'])) {
             $installDir = $extra['opencart-install-dir'];
         }
     }
     if (is_array($installDir)) {
         if (isset($installDir[$prettyName])) {
             $this->installDirCache[$prettyName] = $installDir[$prettyName];
             return $installDir[$prettyName];
         }
         $this->installDirCache[$prettyName] = $this->defaultInstallDir;
         return $this->defaultInstallDir;
     }
     $installDir = $installDir ? $installDir : $this->defaultInstallDir;
     DebugPrinter::log('Computed install dir for package `%s`: `%s`', array($prettyName, $installDir));
     $this->installDirCache[$prettyName] = $installDir;
     return $installDir;
 }
开发者ID:etki,项目名称:opencart-core-installer,代码行数:44,代码来源:Installer.php

示例8: run

 function run(PackageInterface $package, $isMain = true)
 {
     $extra = $package->getExtra();
     if (!isset($extra['bower'])) {
         return;
     }
     if (isset($extra['bower']['dependencies']) and is_array($extra['bower']['dependencies'])) {
         foreach ($extra['bower']['dependencies'] as $package => $version) {
             $this->installPackage($package, $version);
         }
     }
     if (isset($extra['bower']['files']) and is_array($extra['bower']['files'])) {
         foreach ($extra['bower']['files'] as $file) {
             $path = getcwd() . "/" . $file;
             if (is_file($path)) {
                 $bower = json_decode(file_get_contents($path));
                 if (isset($bower->dependencies)) {
                     foreach ($bower->dependencies as $package => $version) {
                         $this->installPackage($package, $version);
                     }
                 }
             } elseif ($isMain) {
                 throw new \OutOfRangeException("File {$file} defined in composer section extra.bower.files does not exist on path: {$path}");
             }
         }
     }
 }
开发者ID:pipaslot,项目名称:modules,代码行数:27,代码来源:Bower.php

示例9:

 function it_should_locate_config_file_on_empty_composer_configuration(Filesystem $filesystem, PackageInterface $package)
 {
     $package->getExtra()->willReturn(array());
     $filesystem->exists($this->pathArgument('/composer/grumphp.yml'))->willReturn(true);
     $filesystem->isAbsolutePath($this->pathArgument('/composer/grumphp.yml'))->willReturn(true);
     $this->locate('/composer', $package)->shouldMatch($this->pathRegex('/composer/grumphp.yml'));
 }
开发者ID:Big-Shark,项目名称:grumphp,代码行数:7,代码来源:ConfigurationFileSpec.php

示例10: getPackageBasePath

 /**
  * {@inheritDoc}
  *
  * @throws \RuntimeException
  */
 public function getPackageBasePath(PackageInterface $package)
 {
     $extra = $package->getExtra();
     if (!empty($extra['installer-name'])) {
         return 'plugins/' . $extra['installer-name'];
     }
     $primaryNS = null;
     $autoLoad = $package->getAutoload();
     foreach ($autoLoad as $type => $pathMap) {
         if ($type !== 'psr-4') {
             continue;
         }
         $count = count($pathMap);
         if ($count === 1) {
             $primaryNS = key($pathMap);
             break;
         }
         $matches = preg_grep('#^(\\./)?src/?$#', $pathMap);
         if ($matches) {
             $primaryNS = key($matches);
             break;
         }
         foreach (['', '.'] as $path) {
             $key = array_search($path, $pathMap, true);
             if ($key !== false) {
                 $primaryNS = $key;
             }
         }
         break;
     }
     if (!$primaryNS) {
         throw new \RuntimeException('Unable to get CakePHP plugin name.');
     }
     return 'plugins/' . trim(str_replace('\\', '/', $primaryNS), '/');
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:40,代码来源:PluginInstaller.php

示例11: getPackageBasePath

 /**
  * @param PackageInterface $package
  *
  * @return string
  */
 public function getPackageBasePath(PackageInterface $package)
 {
     $extra = $package->getExtra();
     print_r($extra);
     // get dependency glue packages
     return parent::getPackageBasePath($package);
 }
开发者ID:assertchris,项目名称:silverstripe-composer-glue-plugin,代码行数:12,代码来源:GluePluginInstaller.php

示例12: getComponentPath

 /**
  * Gets the destination Component directory.
  *
  * @param PackageInterface $package
  * @return string
  *   The path to where the final Component should be installed.
  */
 public function getComponentPath(PackageInterface $package)
 {
     // Parse the pretty name for the vendor and package name.
     $name = $prettyName = $package->getPrettyName();
     if (strpos($prettyName, '/') !== false) {
         list($vendor, $name) = explode('/', $prettyName);
         unset($vendor);
     }
     // First look for an override in root package's extra, then try the package's extra
     $rootPackage = $this->composer->getPackage();
     $rootExtras = $rootPackage ? $rootPackage->getExtra() : array();
     $customComponents = isset($rootExtras['component']) ? $rootExtras['component'] : array();
     if (isset($customComponents[$prettyName]) && is_array($customComponents[$prettyName])) {
         $component = $customComponents[$prettyName];
     } else {
         $extra = $package->getExtra();
         $component = isset($extra['component']) ? $extra['component'] : array();
     }
     // Allow the component to define its own name.
     if (isset($component['name'])) {
         $name = $component['name'];
     }
     // Find where the package should be located.
     return $this->getComponentDir() . DIRECTORY_SEPARATOR . $name;
 }
开发者ID:robloach,项目名称:component-installer,代码行数:32,代码来源:Installer.php

示例13: getPackageBasePath

 /**
  * {@inheritDoc}
  */
 protected function getPackageBasePath(PackageInterface $package)
 {
     $ssp_path = '.';
     $ssp_pack = $this->composer->getRepositoryManager()->getLocalRepository()->findPackage('simplesamlphp/simplesamlphp', '*');
     if ($ssp_pack !== null) {
         $ssp_path = $this->composer->getInstallationManager()->getInstallPath($ssp_pack);
     }
     $name = $package->getPrettyName();
     if (!preg_match('@^.*/simplesamlphp-module-(.+)$@', $name, $matches)) {
         throw new \InvalidArgumentException('Unable to install module ' . $name . ', package name must be on the form "VENDOR/simplesamlphp-module-MODULENAME".');
     }
     $moduleDir = $matches[1];
     if (!preg_match('@^[a-z0-9_.-]*$@', $moduleDir)) {
         throw new \InvalidArgumentException('Unable to install module ' . $name . ', module name must only contain characters from a-z, 0-9, "_", "." and "-".');
     }
     if ($moduleDir[0] === '.') {
         throw new \InvalidArgumentException('Unable to install module ' . $name . ', module name cannot start with ".".');
     }
     /* Composer packages are supposed to only contain lowercase letters, but historically many modules have had names in mixed case.
      * We must provide a way to handle those. Here we allow the module directory to be overridden with a mixed case name.
      */
     $extraData = $package->getExtra();
     if (isset($extraData['ssp-mixedcase-module-name'])) {
         $mixedCaseModuleName = $extraData['ssp-mixedcase-module-name'];
         if (!is_string($mixedCaseModuleName)) {
             throw new \InvalidArgumentException('Unable to install module ' . $name . ', "ssp-mixedcase-module-name" must be a string.');
         }
         if (mb_strtolower($mixedCaseModuleName, 'utf-8') !== $moduleDir) {
             throw new \InvalidArgumentException('Unable to install module ' . $name . ', "ssp-mixedcase-module-name" must match the package name except that it can contain uppercase letters.');
         }
         $moduleDir = $mixedCaseModuleName;
     }
     return $ssp_path . '/modules/' . $moduleDir;
 }
开发者ID:simplesamlphp,项目名称:composer-module-installer,代码行数:37,代码来源:ModuleInstaller.php

示例14: extractName

 /**
  * Extract the theme/plugin name from the package extra info
  *
  * @param PackageInterface $package
  * @throws \InvalidArgumentException
  *
  * @return string
  */
 protected function extractName(PackageInterface $package)
 {
     $extraData = $package->getExtra();
     if (!array_key_exists('ladybug_name', $extraData)) {
         throw new \InvalidArgumentException('Unable to install theme/plugin, ladybug addons must ' . 'include the name in the extra field of composer.json');
     }
     return $extraData['ladybug_name'];
 }
开发者ID:raulfraile,项目名称:ladybug-installer,代码行数:16,代码来源:Installer.php

示例15: getContaoExtra

 /**
  * Retrieves a value from the package extra "contao" section.
  *
  * @param PackageInterface $package The package to extract the section from.
  *
  * @param string           $key     The key to obtain from the extra section.
  *
  * @return mixed|null
  */
 private function getContaoExtra(PackageInterface $package, $key)
 {
     $extras = $package->getExtra();
     if (!isset($extras['contao']) || !isset($extras['contao'][$key])) {
         return null;
     }
     return $extras['contao'][$key];
 }
开发者ID:contao-community-alliance,项目名称:composer-plugin,代码行数:17,代码来源:ContaoModuleInstaller.php


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