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