Parameters   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 7

1 Method

Rating   Name   Duplication   Size   Complexity  
B wrap() 0 14 7
1
<?php
2
namespace yentu;
3
4
class Parameters 
5
{   
6
    public static function wrap($parameters, $defaults = []) 
7
    {
8
        if(!is_array($parameters)) {
9
            return $parameters;
10
        } 
11
        
12
        foreach($defaults as $key => $value) {
13
            if(is_numeric($key) && !isset($parameters[$value])) {
14
                $parameters[$value] = null;
15
            } else if(!is_numeric($key) && !isset($parameters[$key])) {
16
                $parameters[$key] = $value;              
17
            }
18
        }        
19
        return $parameters;
20
    }
21
}
22