@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public static function convSortedObject() { |
72 | 72 | return function($data) { |
73 | - $a = (array)$data; // ksort is inplace, so we need a copy |
|
73 | + $a = (array) $data; // ksort is inplace, so we need a copy |
|
74 | 74 | ksort($a); |
75 | - return (object)$a; |
|
75 | + return (object) $a; |
|
76 | 76 | }; |
77 | 77 | } |
78 | 78 | |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | public static function convArrayOfClass($class) { |
84 | 84 | return function($data) use ($class) { |
85 | 85 | $return = []; |
86 | - if($data !== null) { |
|
86 | + if ($data !== null) { |
|
87 | 87 | foreach ($data as $item) { |
88 | - $return[] = new $class((array)$item); |
|
88 | + $return[] = new $class((array) $item); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | return $return; |
@@ -148,7 +148,7 @@ |
||
148 | 148 | // delete empty fields |
149 | 149 | $return = array_filter( |
150 | 150 | $return, |
151 | - function ($value, $key) { |
|
151 | + function($value, $key) { |
|
152 | 152 | return !is_null($value) || empty($value); |
153 | 153 | }, |
154 | 154 | ARRAY_FILTER_USE_BOTH // there is no ARRAY_FILTER_USE_VALUE |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | if ($key == 'container') { |
97 | 97 | $this->{$key} = new ContainerEntity($value); |
98 | 98 | } else if ($key == 'fetch') { |
99 | - foreach($value as $fetch) { |
|
99 | + foreach ($value as $fetch) { |
|
100 | 100 | $this->{$key}[] = new FetchEntity($fetch); |
101 | 101 | } |
102 | 102 | } else { |
@@ -164,13 +164,13 @@ discard block |
||
164 | 164 | $return['container'] = (array) $this->container; |
165 | 165 | |
166 | 166 | $return['container']['volumes'] = []; |
167 | - foreach($this->container->volumes as $volume) { |
|
167 | + foreach ($this->container->volumes as $volume) { |
|
168 | 168 | $return['container']['volumes'][] = (array) $volume; |
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
172 | 172 | $return['fetch'] = []; |
173 | - foreach($this->fetch as $fetch) { |
|
173 | + foreach ($this->fetch as $fetch) { |
|
174 | 174 | $return['fetch'][] = (array) $fetch; |
175 | 175 | } |
176 | 176 |
@@ -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'] = []; |