Passed
Push — master ( 18efaa...a86e69 )
by Brian
12:41
created

TastyIgniterInstaller   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 26
rs 10
c 1
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A inflectPackageVars() 0 12 3
1
<?php
2
3
namespace Composer\Installers;
4
5
class TastyIgniterInstaller extends BaseInstaller
6
{
7
    protected $locations = array(
8
        'extension' => 'extensions/{$vendor}/{$name}/',
9
        'theme' => 'themes/{$name}/',
10
    );
11
12
    /**
13
     * Format package name.
14
     *
15
     * Cut off leading 'ti-ext-' or 'ti-theme-' if present.
16
     * Strip vendor name of characters that is not alphanumeric or an underscore
17
     *
18
     */
19
    public function inflectPackageVars($vars)
20
    {
21
        if ($vars['type'] === 'tastyigniter-extension') {
22
            $vars['vendor'] = preg_replace('/[^a-z0-9_]/i', '', $vars['vendor']);
23
            $vars['name'] = preg_replace('/^ti-ext-/', '', $vars['name']);
24
        }
25
26
        if ($vars['type'] === 'tastyigniter-theme') {
27
            $vars['name'] = preg_replace('/^ti-theme-/', '', $vars['name']);
28
        }
29
30
        return $vars;
31
    }
32
}