Passed
Push — master ( 4b094a...bf7929 )
by Brian
05:29 queued 53s
created

TaoInstaller::inflectPackageVars()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 8
nc 2
nop 1
dl 0
loc 14
rs 10
c 1
b 0
f 0
1
<?php
2
namespace Composer\Installers;
3
4
/**
5
 * An installer to handle TAO extensions.
6
 */
7
class TaoInstaller extends BaseInstaller
8
{
9
    const EXTRA_TAO_EXTENSION_NAME = 'tao-extension-name';
10
11
    protected $locations = array(
12
        'extension' => '{$name}'
13
    );
14
    
15
    public function inflectPackageVars($vars)
16
    {
17
        $extra = $this->package->getExtra();
0 ignored issues
show
Bug introduced by
The method getExtra() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

17
        /** @scrutinizer ignore-call */ 
18
        $extra = $this->package->getExtra();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
18
19
        if (array_key_exists(self::EXTRA_TAO_EXTENSION_NAME, $extra)) {
20
            $vars['name'] = $extra[self::EXTRA_TAO_EXTENSION_NAME];
21
            return $vars;
22
        }
23
24
        $vars['name'] = str_replace('extension-', '', $vars['name']);
25
        $vars['name'] = str_replace('-', ' ', $vars['name']);
26
        $vars['name'] = lcfirst(str_replace(' ', '', ucwords($vars['name'])));
27
28
        return $vars;
29
    }
30
}
31