Yaffs site version 1.1
[yaffs-website] / vendor / composer / installers / src / Composer / Installers / OctoberInstaller.php
1 <?php
2 namespace Composer\Installers;
3
4 class OctoberInstaller extends BaseInstaller
5 {
6     protected $locations = array(
7         'module'    => 'modules/{$name}/',
8         'plugin'    => 'plugins/{$vendor}/{$name}/',
9         'theme'     => 'themes/{$name}/'
10     );
11
12     /**
13      * Format package name.
14      *
15      * For package type october-plugin, cut off a trailing '-plugin' if present.
16      *
17      * For package type october-theme, cut off a trailing '-theme' if present.
18      *
19      */
20     public function inflectPackageVars($vars)
21     {
22         if ($vars['type'] === 'october-plugin') {
23             return $this->inflectPluginVars($vars);
24         }
25
26         if ($vars['type'] === 'october-theme') {
27             return $this->inflectThemeVars($vars);
28         }
29
30         return $vars;
31     }
32
33     protected function inflectPluginVars($vars)
34     {
35         $vars['name'] = preg_replace('/-plugin$/', '', $vars['name']);
36
37         return $vars;
38     }
39
40     protected function inflectThemeVars($vars)
41     {
42         $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
43
44         return $vars;
45     }
46 }