Conditions | 8 |
Paths | 6 |
Total Lines | 32 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 28.2838 |
Changes | 0 |
1 | <?php |
||
18 | 3 | public function __construct($mJobData = []) |
|
19 | { |
||
20 | 3 | if (is_array($mJobData) || is_object($mJobData)) |
|
21 | 3 | { |
|
22 | 3 | foreach ($mJobData as $_sKey => $_mValue) |
|
23 | { |
||
24 | if (property_exists($this, $_sKey)) |
||
25 | { |
||
26 | if ($_sKey == 'type') |
||
27 | { |
||
28 | $this->{$_sKey} = strtolower($_mValue); |
||
29 | } |
||
30 | elseif ($_sKey == 'volumes') |
||
31 | { |
||
32 | foreach ($_mValue as $_mValueVolume) |
||
33 | { |
||
34 | $_oVolume = new ContainerVolumeEntity($_mValueVolume); |
||
35 | $this->volumes[] = $_oVolume; |
||
36 | } |
||
37 | } |
||
38 | else |
||
39 | { |
||
40 | $this->{$_sKey} = $_mValue; |
||
41 | } |
||
42 | } |
||
43 | 3 | } |
|
44 | 3 | } |
|
45 | else |
||
46 | { |
||
47 | throw new \InvalidArgumentException(sprintf('Argument 1 passed to "%s" must be an array or object', __METHOD__)); |
||
48 | } |
||
49 | 3 | } |
|
50 | |||
66 | } |