Passed
Pull Request — master (#183)
by
unknown
03:23
created

MauticInstaller::inflectPackageVars()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
1
<?php
2
namespace Composer\Installers;
3
4
class MauticInstaller extends BaseInstaller
5
{
6
    protected $locations = array(
7
        'plugin' => 'plugins/{$name}/',
8
        'theme' => 'themes/{$name}/',
9
    );
10
11
    /**
12
     * Format package name of mautic-plugins to CamelCase
13
     */
14
    public function inflectPackageVars($vars)
15
    {
16
        if ($vars['type'] == 'mautic-plugin') {
17
            $vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) {
18
                return strtoupper($matches[0][1]);
19
            }, ucfirst($vars['name']));
20
        }
21
22
        return $vars;
23
    }
24
25
}
26