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

PimcoreInstaller::inflectPackageVars()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 8
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Composer\Installers;
3
4 View Code Duplication
class PimcoreInstaller extends BaseInstaller
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
5
{
6
    protected $locations = array(
7
        'plugin' => 'plugins/{$name}/',
8
    );
9
10
    /**
11
     * Format package name to CamelCase
12
     */
13
    public function inflectPackageVars($vars)
14
    {
15
        $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
16
        $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
17
        $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
18
19
        return $vars;
20
    }
21
}
22