Mercurial > hg > isophonics-drupal-site
annotate vendor/composer/installers/src/Composer/Installers/CraftInstaller.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 namespace Composer\Installers; |
Chris@0 | 3 |
Chris@0 | 4 /** |
Chris@0 | 5 * Installer for Craft Plugins |
Chris@0 | 6 */ |
Chris@0 | 7 class CraftInstaller extends BaseInstaller |
Chris@0 | 8 { |
Chris@0 | 9 const NAME_PREFIX = 'craft'; |
Chris@0 | 10 const NAME_SUFFIX = 'plugin'; |
Chris@0 | 11 |
Chris@0 | 12 protected $locations = array( |
Chris@0 | 13 'plugin' => 'craft/plugins/{$name}/', |
Chris@0 | 14 ); |
Chris@0 | 15 |
Chris@0 | 16 /** |
Chris@0 | 17 * Strip `craft-` prefix and/or `-plugin` suffix from package names |
Chris@0 | 18 * |
Chris@0 | 19 * @param array $vars |
Chris@0 | 20 * |
Chris@0 | 21 * @return array |
Chris@0 | 22 */ |
Chris@0 | 23 final public function inflectPackageVars($vars) |
Chris@0 | 24 { |
Chris@0 | 25 return $this->inflectPluginVars($vars); |
Chris@0 | 26 } |
Chris@0 | 27 |
Chris@0 | 28 private function inflectPluginVars($vars) |
Chris@0 | 29 { |
Chris@0 | 30 $vars['name'] = preg_replace('/-' . self::NAME_SUFFIX . '$/i', '', $vars['name']); |
Chris@0 | 31 $vars['name'] = preg_replace('/^' . self::NAME_PREFIX . '-/i', '', $vars['name']); |
Chris@0 | 32 |
Chris@0 | 33 return $vars; |
Chris@0 | 34 } |
Chris@0 | 35 } |