Passed
Push — master ( 1d60eb...03dff3 )
by Stiofan
06:44 queued 03:02
created

RadPHPInstaller::inflectPackageVars()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 11
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 11
loc 11
rs 9.9
c 0
b 0
f 0
1
<?php
2
namespace Composer\Installers;
3
4 View Code Duplication
class RadPHPInstaller 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
        'bundle' => 'src/{$name}/'
8
    );
9
10
    /**
11
     * Format package name to CamelCase
12
     */
13
    public function inflectPackageVars($vars)
14
    {
15
        $nameParts = explode('/', $vars['name']);
16
        foreach ($nameParts as &$value) {
17
            $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
18
            $value = str_replace(array('-', '_'), ' ', $value);
19
            $value = str_replace(' ', '', ucwords($value));
20
        }
21
        $vars['name'] = implode('/', $nameParts);
22
        return $vars;
23
    }
24
}
25