We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents af93ba6 + 722a5e3 commit c29dc4bCopy full SHA for c29dc4b
README.md
@@ -80,6 +80,7 @@ all vendor code in the vendor directory, and not requiring custom installer code
80
| majima | `majima-plugin`
81
| Mako | `mako-package`
82
| MantisBT | `mantisbt-plugin`
83
+| Matomo | `matomo-plugin`
84
| Mautic | `mautic-core`<br>`mautic-plugin`<br>`mautic-theme`
85
| Maya | `maya-module`
86
| MODX | `modx-extra`
composer.json
@@ -38,6 +38,7 @@
38
"majima",
39
"Mako",
40
"MantisBT",
41
+ "Matomo",
42
"Mautic",
43
"Maya",
44
"MODX",
src/Composer/Installers/Installer.php
@@ -64,6 +64,7 @@ class Installer extends LibraryInstaller
64
'majima' => 'MajimaInstaller',
65
'mantisbt' => 'MantisBTInstaller',
66
'mako' => 'MakoInstaller',
67
+ 'matomo' => 'MatomoInstaller',
68
'maya' => 'MayaInstaller',
69
'mautic' => 'MauticInstaller',
70
'mediawiki' => 'MediaWikiInstaller',
src/Composer/Installers/MatomoInstaller.php
@@ -0,0 +1,28 @@
1
+<?php
2
+
3
+namespace Composer\Installers;
4
5
+/**
6
+ * Class MatomoInstaller
7
+ *
8
+ * @package Composer\Installers
9
+ */
10
+class MatomoInstaller extends BaseInstaller
11
+{
12
+ /** @var array<string, string> */
13
+ protected $locations = array(
14
+ 'plugin' => 'plugins/{$name}/',
15
+ );
16
17
+ /**
18
+ * Format package name to CamelCase
19
20
+ public function inflectPackageVars(array $vars): array
21
+ {
22
+ $vars['name'] = strtolower($this->pregReplace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
23
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
24
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
25
26
+ return $vars;
27
+ }
28
+}
tests/Composer/Installers/Test/InstallerTest.php
@@ -150,6 +150,7 @@ public function supportsProvider(): array
150
array('magento-library', true),
151
array('majima-plugin', true),
152
array('mako-package', true),
153
+ array('matomo-plugin', true),
154
array('mantisbt-plugin', true),
155
array('miaoxing-plugin', true),
156
array('modx-extra', true),
@@ -351,6 +352,7 @@ public function installPathProvider(): array
351
352
array('modxevo-lib', 'assets/lib/my_lib/', 'shama/my_lib'),
353
array('mako-package', 'app/packages/my_package/', 'shama/my_package'),
354
array('mantisbt-plugin', 'plugins/MyPlugin/', 'shama/my_plugin'),
355
+ array('matomo-plugin', 'plugins/VisitSummary/', 'shama/visit-summary'),
356
array('mediawiki-extension', 'extensions/APC/', 'author/APC'),
357
array('mediawiki-extension', 'extensions/APC/', 'author/APC-extension'),
358
array('mediawiki-extension', 'extensions/UploadWizard/', 'author/upload-wizard'),
tests/Composer/Installers/Test/MatomoInstallerTest.php
@@ -0,0 +1,47 @@
+namespace Composer\Installers\Test;
+use Composer\Composer;
+use Composer\Installers\MatomoInstaller;
+use Composer\Package\Package;
+use Composer\Package\PackageInterface;
+ * Class MatomoInstallerTest
+ * @package Composer\Installers\Test
+class MatomoInstallerTest extends TestCase
+ * @var Composer
+ private $composer;
+ * @var Package
+ private $package;
+ public function setUp(): void
29
+ $this->package = new Package('VisitSummary', '1.0', '1.0');
30
+ $this->composer = new Composer();
31
32
33
+ public function testInflectPackageVars(): void
34
35
+ $installer = new MatomoInstaller($this->package, $this->composer, $this->getMockIO());
36
+ $result = $installer->inflectPackageVars(array('name' => 'VisitSummary'));
37
+ $this->assertEquals($result, array('name' => 'VisitSummary'));
+ $result = $installer->inflectPackageVars(array('name' => 'visit-summary'));
+ $result = $installer->inflectPackageVars(array('name' => 'visit_summary'));
45
46
47
0 commit comments