Parser   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A parse() 0 17 3
1
<?php namespace Comodojo\Installer\Parser;
2
3
use Composer\Package\PackageInterface;
4
use Comodojo\Installer\Registry\SupportedTypes;
5
6
/**
7
 *
8
 *
9
 * @package     Comodojo Framework
10
 * @author      Marco Giovinazzi <[email protected]>
11
 * @author      Marco Castiello <[email protected]>
12
 * @license     GPL-3.0+
13
 *
14
 * LICENSE:
15
 *
16
 * This program is free software: you can redistribute it and/or modify
17
 * it under the terms of the GNU Affero General Public License as
18
 * published by the Free Software Foundation, either version 3 of the
19
 * License, or (at your option) any later version.
20
 *
21
 * This program is distributed in the hope that it will be useful,
22
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 * GNU Affero General Public License for more details.
25
 *
26
 * You should have received a copy of the GNU Affero General Public License
27
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
28
 */
29
30
class Parser {
31
32
    public static function parse(PackageInterface $package) {
33
34
        $type = $package->getType();
35
36
        $extra = $package->getExtra();
37
38
        $map = array();
39
40
        foreach (SupportedTypes::getActions($type) as $field => $action) {
41
42
            if ( isset($extra[$field]) ) $map[$action] = $extra[$field];
43
44
        }
45
46
        return $map;
47
48
    }
49
50
}
51