PluginProbe
Code Snippets / trunk
Code Snippets vtrunk
4.0.0-beta.2 3.10.2 3.10.1 3.10.0 3.10.0-beta.2 3.10.0-beta.1 4.0.0-beta.1 3.9.6 trunk 2.10.0 2.10.1 2.12.0 2.12.1 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 3.0.0 All 65 releases
← All changes | vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php +17 -8 3.0.0 → trunk View file →
@@ -1,9 +1,11 @@
1 1 <?php
2 +
2 3 namespace Composer\Installers;
3 4
4 5 class OctoberInstaller extends BaseInstaller
5 6 {
7 + /** @var array<string, string> */
6 8 protected $locations = array(
7 9 'module' => 'modules/{$name}/',
8 10 'plugin' => 'plugins/{$vendor}/{$name}/',
9 11 'theme' => 'themes/{$vendor}-{$name}/'
@@ -14,11 +16,10 @@
14 16 *
15 17 * For package type october-plugin, cut off a trailing '-plugin' if present.
16 18 *
17 19 * For package type october-theme, cut off a trailing '-theme' if present.
18 - *
19 20 */
20 - public function inflectPackageVars($vars)
21 + public function inflectPackageVars(array $vars): array
21 22 {
22 23 if ($vars['type'] === 'october-plugin') {
23 24 return $this->inflectPluginVars($vars);
24 25 }
@@ -29,20 +30,28 @@
29 30
30 31 return $vars;
31 32 }
32 33
33 - protected function inflectPluginVars($vars)
34 + /**
35 + * @param array<string, string> $vars
36 + * @return array<string, string>
37 + */
38 + protected function inflectPluginVars(array $vars): array
34 39 {
35 - $vars['name'] = preg_replace('/^oc-|-plugin$/', '', $vars['name']);
36 - $vars['vendor'] = preg_replace('/[^a-z0-9_]/i', '', $vars['vendor']);
40 + $vars['name'] = $this->pregReplace('/^oc-|-plugin$/', '', $vars['name']);
41 + $vars['vendor'] = $this->pregReplace('/[^a-z0-9_]/i', '', $vars['vendor']);
37 42
38 43 return $vars;
39 44 }
40 45
41 - protected function inflectThemeVars($vars)
46 + /**
47 + * @param array<string, string> $vars
48 + * @return array<string, string>
49 + */
50 + protected function inflectThemeVars(array $vars): array
42 51 {
43 - $vars['name'] = preg_replace('/^oc-|-theme$/', '', $vars['name']);
44 - $vars['vendor'] = preg_replace('/[^a-z0-9_]/i', '', $vars['vendor']);
52 + $vars['name'] = $this->pregReplace('/^oc-|-theme$/', '', $vars['name']);
53 + $vars['vendor'] = $this->pregReplace('/[^a-z0-9_]/i', '', $vars['vendor']);
45 54
46 55 return $vars;
47 56 }
48 57 }