Completed
Push — next ( 14e430...cf6e7a )
by Mathias
03:25
created
src/Client/DataTransformer.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -153,66 +153,66 @@  discard block
 block discarded – undo
153 153
      *
154 154
      * @return string
155 155
      */
156
-    public function transform(JobInterface $job, $options = [])
156
+    public function transform(JobInterface $job, $options = [ ])
157 157
     {
158 158
         $applyUrl = $this->getApplyUrlHelper();
159 159
         $serverUrl = $this->getServerUrlHelper();
160 160
         $imageManager = $this->getOrganizationImageManager();
161 161
 
162 162
         $jobSpec = [
163
-            'action' => isset($options['action']) ? $options['action'] : 'post',
163
+            'action' => isset($options[ 'action' ]) ? $options[ 'action' ] : 'post',
164 164
             //'test' => 'true',
165 165
 
166 166
         ];
167 167
 
168
-        if (isset($options['externalId'])) {
169
-            $jobSpec['jobid'] = $options['externalId'];
168
+        if (isset($options[ 'externalId' ])) {
169
+            $jobSpec[ 'jobid' ] = $options[ 'externalId' ];
170 170
         }
171 171
 
172
-        $jobSpec[':title'] = $job->getTitle();
173
-        $jobSpec[':company'] = $job->getOrganization()->getOrganizationName()->getName();
174
-        $jobSpec[':companyurl'] = $job->getOrganization()->getContact()->getWebsite() ?: '';
172
+        $jobSpec[ ':title' ] = $job->getTitle();
173
+        $jobSpec[ ':company' ] = $job->getOrganization()->getOrganizationName()->getName();
174
+        $jobSpec[ ':companyurl' ] = $job->getOrganization()->getContact()->getWebsite() ?: '';
175 175
 
176 176
         if (($image = $job->getOrganization()->getImage()) && $serverUrl && $imageManager) {
177 177
             $imageUri = $imageManager->getUri($image);
178
-            $jobSpec['logourl'] = $serverUrl($imageUri);
178
+            $jobSpec[ 'logourl' ] = $serverUrl($imageUri);
179 179
         }
180 180
 
181 181
         if ($companyDesc = $job->getOrganization()->getDescription()) {
182
-            $jobSpec[':aboutcompany'] = $companyDesc;
182
+            $jobSpec[ ':aboutcompany' ] = $companyDesc;
183 183
         }
184 184
 
185
-        $jobSpec['vendorid'] = $job->getId();
185
+        $jobSpec[ 'vendorid' ] = $job->getId();
186 186
 
187 187
         $atsMode = $job->getAtsMode();
188 188
         if ($atsMode->isDisabled()) {
189
-            $jobSpec['howtoapply'] = 'postalisch';
189
+            $jobSpec[ 'howtoapply' ] = 'postalisch';
190 190
         } else if ($atsMode->isEmail()) {
191
-            $jobSpec['howtoapply'] = $atsMode->getEmail();
191
+            $jobSpec[ 'howtoapply' ] = $atsMode->getEmail();
192 192
         } else if ($atsMode->isUri()) {
193
-            $jobSpec['howtoapply'] = $atsMode->getUri();
193
+            $jobSpec[ 'howtoapply' ] = $atsMode->getUri();
194 194
         } else if (is_callable($applyUrl) && $serverUrl) {
195
-            $jobSpec['howtoapply'] = $serverUrl($applyUrl($job, ['linkOnly' => true, 'absolute' => true]));
195
+            $jobSpec[ 'howtoapply' ] = $serverUrl($applyUrl($job, [ 'linkOnly' => true, 'absolute' => true ]));
196 196
         } else {
197
-            $jobSpec['howtoapply'] =  'postalisch';
197
+            $jobSpec[ 'howtoapply' ] = 'postalisch';
198 198
         }
199 199
 
200 200
 
201 201
 
202 202
         /* Location override by additional data */
203
-        if (isset($options['location'])) {
204
-            $location = new Location($options['location']);
205
-            $locations = new ArrayCollection([$location]);
203
+        if (isset($options[ 'location' ])) {
204
+            $location = new Location($options[ 'location' ]);
205
+            $locations = new ArrayCollection([ $location ]);
206 206
         } else {
207 207
             $locations = $job->getLocations();
208 208
         }
209 209
 
210 210
         if ($locations->count()) {
211
-            $loc = [];
211
+            $loc = [ ];
212 212
 
213 213
             foreach ($locations as $location) {
214 214
                 /* \Jobs\Entity\Location $location */
215
-                $tmpLoc = [];
215
+                $tmpLoc = [ ];
216 216
                 $coords = $location->getCoordinates();
217 217
                 $postalCode = $location->getPostalCode();
218 218
                 $city = $location->getCity();
@@ -226,65 +226,65 @@  discard block
 block discarded – undo
226 226
                 if ($country) { $str .= ', ' . $country; }
227 227
 
228 228
 
229
-                $tmpLoc['_text'] = $str;
229
+                $tmpLoc[ '_text' ] = $str;
230 230
                 if ($coords) {
231 231
                     $coords = $coords->getCoordinates();
232
-                    $tmpLoc['@lon'] = $coords[0];
233
-                    $tmpLoc['@lat'] = $coords[1];
232
+                    $tmpLoc[ '@lon' ] = $coords[ 0 ];
233
+                    $tmpLoc[ '@lat' ] = $coords[ 1 ];
234 234
                 }
235 235
 
236
-                $loc[] = $tmpLoc;
236
+                $loc[ ] = $tmpLoc;
237 237
             }
238 238
 
239
-            $jobSpec['locations']['location'] = $loc;
239
+            $jobSpec[ 'locations' ][ 'location' ] = $loc;
240 240
         }
241 241
 
242
-        foreach (['topspot', 'featured', 'remote', 'relocation', 'visasponsorship', 'sysadmin'] as $boolOpt) {
243
-            if (isset($options[$boolOpt])) {
244
-                $jobSpec[$boolOpt] = $options[$boolOpt] ? 'true' : 'false';
242
+        foreach ([ 'topspot', 'featured', 'remote', 'relocation', 'visasponsorship', 'sysadmin' ] as $boolOpt) {
243
+            if (isset($options[ $boolOpt ])) {
244
+                $jobSpec[ $boolOpt ] = $options[ $boolOpt ] ? 'true' : 'false';
245 245
             }
246 246
         }
247 247
 
248
-        foreach (['length', 'coupon', 'pixel'] as $strOpt) {
249
-            if (isset($options[$strOpt])) {
250
-                $jobSpec[$strOpt] = $options[$strOpt];
248
+        foreach ([ 'length', 'coupon', 'pixel' ] as $strOpt) {
249
+            if (isset($options[ $strOpt ])) {
250
+                $jobSpec[ $strOpt ] = $options[ $strOpt ];
251 251
             }
252 252
         }
253 253
 
254 254
         $link = $job->getLink();
255
-        $jobSpec[':description'] = $link ? $this->getDescriptionFilter()->filter($link) : '<p></p>';
255
+        $jobSpec[ ':description' ] = $link ? $this->getDescriptionFilter()->filter($link) : '<p></p>';
256 256
 
257 257
         if ($requirements = $job->getTemplateValues()->getRequirements()) {
258
-            $jobSpec[':requirements'] = $requirements;
258
+            $jobSpec[ ':requirements' ] = $requirements;
259 259
         }
260 260
 
261
-        $tags = [];
262
-        if (isset($options['keywords']) && is_array($options['keyword'])) {
263
-            foreach ($options['keywords'] as $keyword) {
264
-                $tags[] = ['tag' => $keyword];
261
+        $tags = [ ];
262
+        if (isset($options[ 'keywords' ]) && is_array($options[ 'keyword' ])) {
263
+            foreach ($options[ 'keywords' ] as $keyword) {
264
+                $tags[ ] = [ 'tag' => $keyword ];
265 265
             }
266 266
         } else {
267
-            $tags[] = ['tag' => 'none'];
267
+            $tags[ ] = [ 'tag' => 'none' ];
268 268
         }
269
-        $jobSpec['tags'] = $tags;
269
+        $jobSpec[ 'tags' ] = $tags;
270 270
 
271
-        if (isset($options['advertisingregions']) && is_array($options['advertisingregions'])) {
272
-            $regions = [];
273
-            foreach ($options['advertisingregions'] as $adreg) {
274
-                $regions[] = ['regioncode' => $adreg];
271
+        if (isset($options[ 'advertisingregions' ]) && is_array($options[ 'advertisingregions' ])) {
272
+            $regions = [ ];
273
+            foreach ($options[ 'advertisingregions' ] as $adreg) {
274
+                $regions[ ] = [ 'regioncode' => $adreg ];
275 275
             }
276
-            $jobSpec['advertisingregions'] = $regions;
276
+            $jobSpec[ 'advertisingregions' ] = $regions;
277 277
         }
278 278
 
279
-        if (isset($options['advertisingcountries']) && is_array($options['advertisingcountries'])) {
280
-            $countries = [];
281
-            foreach ($options['advertisingcountries'] as $adcountry) {
282
-                $countries[] = ['regioncode' => $adcountry];
279
+        if (isset($options[ 'advertisingcountries' ]) && is_array($options[ 'advertisingcountries' ])) {
280
+            $countries = [ ];
281
+            foreach ($options[ 'advertisingcountries' ] as $adcountry) {
282
+                $countries[ ] = [ 'regioncode' => $adcountry ];
283 283
             }
284
-            $jobSpec['advertisingcountrycodes'] = $countries;
284
+            $jobSpec[ 'advertisingcountrycodes' ] = $countries;
285 285
         }
286 286
 
287 287
 
288
-        return XmlBuilder::createXml(['job' => $jobSpec]);
288
+        return XmlBuilder::createXml([ 'job' => $jobSpec ]);
289 289
     }
290 290
 }
Please login to merge, or discard this patch.