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


PHP PackageInterface::getName方法代码示例

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


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

示例1: download

 /**
  * {@inheritdoc}
  */
 public function download(PackageInterface $package, $path)
 {
     $url = $package->getDistUrl();
     $realUrl = realpath($url);
     if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
         throw new \RuntimeException(sprintf('Source path "%s" is not found for package %s', $url, $package->getName()));
     }
     if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
         throw new \RuntimeException(sprintf('Package %s cannot install to "%s" inside its source at "%s"', $package->getName(), realpath($path), $realUrl));
     }
     $fileSystem = new Filesystem();
     $this->filesystem->removeDirectory($path);
     $this->io->writeError(sprintf('  - Installing <info>%s</info> (<comment>%s</comment>)', $package->getName(), $package->getFullPrettyVersion()));
     try {
         if (Platform::isWindows()) {
             // Implement symlinks as NTFS junctions on Windows
             $this->filesystem->junction($realUrl, $path);
             $this->io->writeError(sprintf('    Junctioned from %s', $url));
         } else {
             $shortestPath = $this->filesystem->findShortestPath($path, $realUrl);
             $fileSystem->symlink($shortestPath, $path);
             $this->io->writeError(sprintf('    Symlinked from %s', $url));
         }
     } catch (IOException $e) {
         $fileSystem->mirror($realUrl, $path);
         $this->io->writeError(sprintf('    Mirrored from %s', $url));
     }
     $this->io->writeError('');
 }
开发者ID:alcaeus,项目名称:composer,代码行数:32,代码来源:PathDownloader.php

示例2: getPattern

 /**
  * Retrieve the pattern for the given package.
  *
  * @param \Composer\Package\PackageInterface $package
  *
  * @return string
  */
 public function getPattern(PackageInterface $package)
 {
     if (isset($this->packages[$package->getName()])) {
         return $this->packages[$package->getName()];
     } elseif (isset($this->packages[$package->getPrettyName()])) {
         return $this->packages[$package->getPrettyName()];
     } elseif (isset($this->types[$package->getType()])) {
         return $this->types[$package->getType()];
     }
 }
开发者ID:davidbarratt,项目名称:custom-installer,代码行数:17,代码来源:Configuration.php

示例3: filterRequiredPackages

 private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
 {
     $requires = array_keys($package->getRequires());
     $packageListNames = array_keys($bucket);
     $packages = array_filter($repo->getPackages(), function ($package) use($requires, $packageListNames) {
         return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
     });
     $bucket = $this->appendPackages($packages, $bucket);
     foreach ($packages as $package) {
         $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
     }
     return $bucket;
 }
开发者ID:VicDeo,项目名称:poc,代码行数:13,代码来源:LicensesCommand.php

示例4: make

 /**
  * @param PackageInterface $package
  * @param string $packageSourcePath
  * @return DeploystrategyAbstract
  */
 public function make(PackageInterface $package, $packageSourcePath)
 {
     $strategyName = $this->config->getModuleSpecificDeployStrategy($package->getName());
     $ns = '\\MagentoHackathon\\Composer\\Magento\\Deploystrategy\\';
     $className = $ns . ucfirst($strategyName);
     if (!class_exists($className)) {
         $className = $ns . 'Symlink';
     }
     $strategy = new $className($packageSourcePath, realpath($this->config->getMagentoRootDir()));
     $strategy->setIgnoredMappings($this->config->getModuleSpecificDeployIgnores($package->getName()));
     $strategy->setIsForced($this->config->getMagentoForceByPackageName($package->getName()));
     $mappingParser = $this->parserFactory->make($package, $packageSourcePath);
     $strategy->setMappings($mappingParser->getMappings());
     return $strategy;
 }
开发者ID:Aleksandr-Kachura,项目名称:magento,代码行数:20,代码来源:InstallStrategyFactory.php

示例5: __construct

 /**
  * All descendants' constructors should call this parent constructor
  *
  * @param PackageInterface $aliasOf       The package this package is an alias of
  * @param string           $version       The version the alias must report
  * @param string           $prettyVersion The alias's non-normalized version
  */
 public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
 {
     parent::__construct($aliasOf->getName());
     $this->version = $version;
     $this->prettyVersion = $prettyVersion;
     $this->aliasOf = $aliasOf;
     $this->stability = VersionParser::parseStability($version);
     $this->dev = $this->stability === 'dev';
     // replace self.version dependencies
     foreach (array('requires', 'devRequires') as $type) {
         $links = $aliasOf->{'get' . ucfirst($type)}();
         foreach ($links as $index => $link) {
             // link is self.version, but must be replacing also the replaced version
             if ('self.version' === $link->getPrettyConstraint()) {
                 $links[$index] = new Link($link->getSource(), $link->getTarget(), new VersionConstraint('=', $this->version), $type, $prettyVersion);
             }
         }
         $this->{$type} = $links;
     }
     // duplicate self.version provides
     foreach (array('conflicts', 'provides', 'replaces') as $type) {
         $links = $aliasOf->{'get' . ucfirst($type)}();
         $newLinks = array();
         foreach ($links as $link) {
             // link is self.version, but must be replacing also the replaced version
             if ('self.version' === $link->getPrettyConstraint()) {
                 $newLinks[] = new Link($link->getSource(), $link->getTarget(), new VersionConstraint('=', $this->version), $type, $prettyVersion);
             }
         }
         $this->{$type} = array_merge($links, $newLinks);
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:39,代码来源:AliasPackage.php

示例6: update

 /**
  * {@inheritDoc}
  */
 public function update(PackageInterface $initial, PackageInterface $target, $path)
 {
     if (!$target->getSourceReference()) {
         throw new \InvalidArgumentException('Package ' . $target->getPrettyName() . ' is missing reference information');
     }
     $name = $target->getName();
     if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
         $from = $initial->getSourceReference();
         $to = $target->getSourceReference();
         $name .= ' ' . $initial->getPrettyVersion();
     } else {
         $from = $initial->getFullPrettyVersion();
         $to = $target->getFullPrettyVersion();
     }
     $this->io->writeError("  - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
     $urls = $target->getSourceUrls();
     while ($url = array_shift($urls)) {
         try {
             if (Filesystem::isLocalPath($url)) {
                 $url = realpath($url);
             }
             $this->doUpdate($initial, $target, $path, $url);
             break;
         } catch (\Exception $e) {
             if ($this->io->isDebug()) {
                 $this->io->writeError('Failed: [' . get_class($e) . '] ' . $e->getMessage());
             } elseif (count($urls)) {
                 $this->io->writeError('    Failed, trying the next URL');
             } else {
                 throw $e;
             }
         }
     }
     $this->io->writeError('');
 }
开发者ID:linearsoft,项目名称:composer-svn-export,代码行数:38,代码来源:Downloader.php

示例7: getInstallDir

 /**
  * Get the installation directory of the package.
  *
  * @param Composer         $composer   The composer instance
  * @param PackageInterface $package    The package instance
  * @param string|null      $installDir The custom installation directory
  *
  * @return string The installation directory
  */
 protected static function getInstallDir(Composer $composer, PackageInterface $package, $installDir = null)
 {
     if (null === $installDir) {
         $installDir = rtrim($composer->getConfig()->get('vendor-dir'), '/') . '/' . $package->getName();
     }
     return rtrim($installDir, '/');
 }
开发者ID:MvegaR,项目名称:ingSotfware,代码行数:16,代码来源:IgnoreFactory.php

示例8: getApplicationCode

 /**
  * Returns Claromentis application name (folder)
  *
  * @param PackageInterface $package
  *
  * @return string
  */
 protected function getApplicationCode(PackageInterface $package)
 {
     $pkg_name = $package->getName();
     list(, $app_name) = explode('/', $pkg_name);
     $app_name = preg_replace("/-(src|obf|php5?|php7)\$/", '', $app_name);
     return $app_name;
 }
开发者ID:claromentis,项目名称:installer-composer-plugin,代码行数:14,代码来源:ModuleInstallerV7.php

示例9: primaryNamespace

 /**
  * Get the primary namespace for a plugin package.
  *
  * @param \Composer\Package\PackageInterface $package composer object
  * @return string The package's primary namespace.
  * @throws \RuntimeException When the package's primary namespace cannot be determined.
  */
 public function primaryNamespace($package)
 {
     $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(sprintf("Unable to get primary namespace for package %s." . "\nEnsure you have added proper 'autoload' section to your plugin's config", $package->getName()));
     }
     return trim($primaryNs, '\\');
 }
开发者ID:CoreTyson,项目名称:plugin-installer,代码行数:38,代码来源:Installer.php

示例10: uninstall

 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     $this->initGingerBackend();
     $extra = $package->getExtra();
     $uninstallPluginCommand = new Cqrs\UninstallPluginCommand(array('plugin_name' => $package->getName(), 'plugin_type' => $package->getType(), 'plugin_namespace' => $extra['plugin-namespace'], 'plugin_version' => $package->getVersion()));
     $this->getServiceManager()->get('malocher.cqrs.gate')->getBus()->invokeCommand($uninstallPluginCommand);
     parent::uninstall($repo, $package);
 }
开发者ID:gingerwfms,项目名称:ginger-plugin-installer,代码行数:8,代码来源:GingerInstaller.php

示例11: getInstallPath

 /**
  * Return the install path based on package type.
  *
  * Relies on built-in BaseInstaller behaviour with one exception: silverstripe/framework
  * must be installed to 'sapphire' and not 'framework' if the version is <3.0.0
  *
  * @param  PackageInterface $package
  * @param  string           $frameworkType
  * @return string
  */
 public function getInstallPath(PackageInterface $package, $frameworkType = '')
 {
     if ($package->getName() == 'silverstripe/framework' && preg_match('/^\\d+\\.\\d+\\.\\d+/', $package->getVersion()) && version_compare($package->getVersion(), '2.999.999') < 0) {
         return $this->templatePath($this->locations['module'], array('name' => 'sapphire'));
     } else {
         return parent::getInstallPath($package, $frameworkType);
     }
 }
开发者ID:santikrass,项目名称:apache,代码行数:18,代码来源:SilverStripeInstaller.php

示例12: getInstallPath

 public function getInstallPath(PackageInterface $package)
 {
     $extra = $package->getExtra();
     if (!$extra['install-name']) {
         throw new \InvalidArgumentException(sprintf('The "%s" application is not set "installer-name" field.' . PHP_EOL . 'Using the following config within your package composer.json will allow this:' . PHP_EOL . '{' . PHP_EOL . '    "name": "vendor/name",' . PHP_EOL . '    "type": "thinksns-app",' . PHP_EOL . '    "extra": {' . PHP_EOL . '        "installer-name": "Demo-Name"' . PHP_EOL . '    }' . PHP_EOL . '}' . PHP_EOL), $package->getName());
     }
     return 'apps/' . $extra['install-name'];
 }
开发者ID:medz,项目名称:thinksns-installer-plugin,代码行数:8,代码来源:Installer.php

示例13: getInstallPath

 public function getInstallPath(PackageInterface $package)
 {
     $extra = $this->composer->getPackage()->getExtra();
     if (empty($extra['phpbb-ext-install-dir'])) {
         $extra['phpbb-ext-install-dir'] = 'ext';
     }
     return $extra['phpbb-ext-install-dir'] . '/' . $package->getName();
 }
开发者ID:zoddo,项目名称:composer-phpbb-extension-installer,代码行数:8,代码来源:PhpbbExtensionInstaller.php

示例14: remove

 /**
  * {@inheritDoc}
  */
 public function remove(PackageInterface $package, $path)
 {
     $this->enforceCleanDirectory($path);
     $this->io->write("  - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
     if (!$this->filesystem->removeDirectory($path)) {
         throw new \RuntimeException('Could not completely delete ' . $path . ', aborting.');
     }
 }
开发者ID:nicodmf,项目名称:composer,代码行数:11,代码来源:VcsDownloader.php

示例15: getInstallPath

 /**
  *
  * @param PackageInterface $package        	
  *
  * @return string a path relative to the root of the composer.json that is being installed.
  */
 public function getInstallPath(PackageInterface $package)
 {
     $type = $package->getType();
     if ($type === 'keeko-core') {
         return 'core';
     }
     return $this->getPackageDir($type) . '/' . $package->getName();
 }
开发者ID:JasLin,项目名称:composer-installer,代码行数:14,代码来源:KeekoComposerInstaller.php


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