TraitOptions   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 91.67%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 5
c 2
b 0
f 1
lcom 0
cbo 0
dl 0
loc 22
ccs 11
cts 12
cp 0.9167
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B setOptions() 0 18 5
1
<?php
2
3
namespace Cronario;
4
5
trait TraitOptions
6
{
7
8 57
    final private function setOptions(array $options = [])
9
    {
10 57
        if (empty($options)) {
11 53
            return $this;
12
        }
13
14 23
        foreach ($options as $key => $value) {
15 23
            $method = 'set' . ucfirst($key);
16 23
            if ($method == 'setOptions') {
17
                continue;
18
            }
19 23
            if (method_exists($this, $method)) {
20 23
                $this->{$method}($value);
21 23
            }
22 23
        }
23
24 23
        return $this;
25
    }
26
}