@@ -95,20 +95,24 @@ discard block |
||
| 95 | 95 | if (property_exists($this, $key)) { |
| 96 | 96 | if ($key == 'container') { |
| 97 | 97 | $this->{$key} = new ContainerEntity($value); |
| 98 | - } else if ($key == 'fetch') { |
|
| 98 | + } |
|
| 99 | + else if ($key == 'fetch') { |
|
| 99 | 100 | foreach ($value as $fetch) { |
| 100 | 101 | $this->{$key}[] = new FetchEntity($fetch); |
| 101 | 102 | } |
| 102 | - } else { |
|
| 103 | + } |
|
| 104 | + else { |
|
| 103 | 105 | $this->{$key} = $value; |
| 104 | 106 | } |
| 105 | - } else { |
|
| 107 | + } |
|
| 108 | + else { |
|
| 106 | 109 | /* We are ignoring fields that are unknown to us. This is bad and can lead to unexpected differences |
| 107 | 110 | * when comparing the *.json on disk with the job definition from the Chronos API. |
| 108 | 111 | */ |
| 109 | 112 | } |
| 110 | 113 | } |
| 111 | - } else { |
|
| 114 | + } |
|
| 115 | + else { |
|
| 112 | 116 | throw new \InvalidArgumentException(sprintf('Argument 1 passed to "%s" must be an array or object', __METHOD__)); |
| 113 | 117 | } |
| 114 | 118 | } |
@@ -153,14 +157,16 @@ discard block |
||
| 153 | 157 | $return = (array) $this; |
| 154 | 158 | if (!empty($this->schedule)) { |
| 155 | 159 | unset($return['parents']); |
| 156 | - } else { |
|
| 160 | + } |
|
| 161 | + else { |
|
| 157 | 162 | unset($return['schedule']); |
| 158 | 163 | unset($return['scheduleTimeZone']); |
| 159 | 164 | } |
| 160 | 165 | |
| 161 | 166 | if (empty($this->container)) { |
| 162 | 167 | unset($return['container']); |
| 163 | - } else { |
|
| 168 | + } |
|
| 169 | + else { |
|
| 164 | 170 | $return['container'] = (array) $this->container; |
| 165 | 171 | |
| 166 | 172 | $return['container']['volumes'] = []; |