PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / trunk
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF vtrunk
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
imagify / vendor / composer / installers / src / Composer / Installers / MediaWikiInstaller.php

MediaWikiInstaller.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF trunk, at vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php

59 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Composer\Installers;
4
5 class MediaWikiInstaller extends BaseInstaller
6 {
7 /** @var array<string, string> */
8 protected $locations = array(
9 'core' => 'core/',
10 'extension' => 'extensions/{$name}/',
11 'skin' => 'skins/{$name}/',
12 );
13
14 /**
15 * Format package name.
16 *
17 * For package type mediawiki-extension, cut off a trailing '-extension' if present and transform
18 * to CamelCase keeping existing uppercase chars.
19 *
20 * For package type mediawiki-skin, cut off a trailing '-skin' if present.
21 */
22 public function inflectPackageVars(array $vars): array
23 {
24 if ($vars['type'] === 'mediawiki-extension') {
25 return $this->inflectExtensionVars($vars);
26 }
27
28 if ($vars['type'] === 'mediawiki-skin') {
29 return $this->inflectSkinVars($vars);
30 }
31
32 return $vars;
33 }
34
35 /**
36 * @param array<string, string> $vars
37 * @return array<string, string>
38 */
39 protected function inflectExtensionVars(array $vars): array
40 {
41 $vars['name'] = $this->pregReplace('/-extension$/', '', $vars['name']);
42 $vars['name'] = str_replace('-', ' ', $vars['name']);
43 $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
44
45 return $vars;
46 }
47
48 /**
49 * @param array<string, string> $vars
50 * @return array<string, string>
51 */
52 protected function inflectSkinVars(array $vars): array
53 {
54 $vars['name'] = $this->pregReplace('/-skin$/', '', $vars['name']);
55
56 return $vars;
57 }
58 }
59