@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | ], |
20 | 20 | ], |
21 | 21 | 'annotation' => [ |
22 | - 'paths' => [ __DIR__ . '/../src/Entity'] |
|
22 | + 'paths' => [ __DIR__ . '/../src/Entity' ] |
|
23 | 23 | ], |
24 | 24 | ], |
25 | 25 | ], |
@@ -64,6 +64,6 @@ discard block |
||
64 | 64 | ], |
65 | 65 | 'lazy' => true, |
66 | 66 | ], |
67 | - ]], |
|
67 | + ] ], |
|
68 | 68 | ], |
69 | 69 | ]; |
@@ -55,7 +55,7 @@ |
||
55 | 55 | |
56 | 56 | $job = $event->getJobEntity(); |
57 | 57 | $options = $event->getParam('extraData'); |
58 | - $options = isset($options[ 'channels' ][ 'stackoverflow' ]) ? $options[ 'channels' ][ 'stackoverflow' ] : []; |
|
58 | + $options = isset($options[ 'channels' ][ 'stackoverflow' ]) ? $options[ 'channels' ][ 'stackoverflow' ] : [ ]; |
|
59 | 59 | |
60 | 60 | return $this->createResponse($this->manager->send($job, $options)); |
61 | 61 | } |
@@ -61,7 +61,7 @@ |
||
61 | 61 | public function __call($method, $args) |
62 | 62 | { |
63 | 63 | $response = $this->getResponse(); |
64 | - $callback = [$response, $method]; |
|
64 | + $callback = [ $response, $method ]; |
|
65 | 65 | |
66 | 66 | if (is_callable($callback)) { |
67 | 67 | $returned = call_user_func_array($callback, $args); |
@@ -64,36 +64,36 @@ |
||
64 | 64 | $log->info('Send Job: ' . $job->getId()); |
65 | 65 | $status = true; |
66 | 66 | |
67 | - $jobData = $job->hasAttachedEntity('stackoverflow') ? $job->getAttachedEntity('stackoverflow') : $job->createAttachedEntity(JobData::class, ['jobId' => $job->getId()], 'stackoverflow'); |
|
67 | + $jobData = $job->hasAttachedEntity('stackoverflow') ? $job->getAttachedEntity('stackoverflow') : $job->createAttachedEntity(JobData::class, [ 'jobId' => $job->getId() ], 'stackoverflow'); |
|
68 | 68 | |
69 | 69 | if ($jobData->isOnline()) { |
70 | - $data['action'] = 'put'; |
|
71 | - $data['externalId'] = $jobData->getExternalId(); |
|
70 | + $data[ 'action' ] = 'put'; |
|
71 | + $data[ 'externalId' ] = $jobData->getExternalId(); |
|
72 | 72 | $log->debug('--> Job is already online: External id ' . $jobData->getExternalId() . ': update'); |
73 | 73 | } else { |
74 | - $data['action'] = 'post'; |
|
74 | + $data[ 'action' ] = 'post'; |
|
75 | 75 | $log->debug('--> Job is not online: insert'); |
76 | 76 | } |
77 | 77 | |
78 | - $log->debug('--> data:' , $data); |
|
78 | + $log->debug('--> data:', $data); |
|
79 | 79 | $response = $this->client->sendJob($job, $data); |
80 | 80 | |
81 | 81 | $apiResponse = new ApiResponse($response); |
82 | 82 | |
83 | - $result = $response->getXml(); |
|
83 | + $result = $response->getXml(); |
|
84 | 84 | if ($result) { |
85 | 85 | //$result = $result->response; |
86 | 86 | if ('success' == $result->result) { |
87 | 87 | $jobData->setExternalId($result->jobid) |
88 | 88 | ->setExternalUrl($result->joburl) |
89 | 89 | ->setIsOnline(true); |
90 | - $log->info('==> Successfully send ' . $job->getId(), ['id' => $result->jobid, 'url' => $result->joburl]); |
|
90 | + $log->info('==> Successfully send ' . $job->getId(), [ 'id' => $result->jobid, 'url' => $result->joburl ]); |
|
91 | 91 | |
92 | 92 | } else { |
93 | 93 | $status = false; |
94 | 94 | $log->err('==> Sending job ' . $job->getId() . ' failed.'); |
95 | 95 | $errors = (array) $result->errors->error; |
96 | - $log->debug($response->getStatusCode() . ': ' . $response->getReasonPhrase(), ['errors' => $errors, 'body' => $response->getBody()]); |
|
96 | + $log->debug($response->getStatusCode() . ': ' . $response->getReasonPhrase(), [ 'errors' => $errors, 'body' => $response->getBody() ]); |
|
97 | 97 | } |
98 | 98 | } else { |
99 | 99 | $status = false; |
@@ -104,19 +104,19 @@ |
||
104 | 104 | $name = '_text'; |
105 | 105 | } |
106 | 106 | } else if (0 === strpos($name, ':')) { |
107 | - $spec = ['_cdata' => $spec]; |
|
107 | + $spec = [ '_cdata' => $spec ]; |
|
108 | 108 | $name = substr($name, 1); |
109 | 109 | } else if (0 === strpos($spec, ':')) { |
110 | - $spec = ['_cdata' => substr($spec, 1)]; |
|
110 | + $spec = [ '_cdata' => substr($spec, 1) ]; |
|
111 | 111 | } else { |
112 | - $spec = ['_text' => $spec]; |
|
112 | + $spec = [ '_text' => $spec ]; |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | 116 | if (is_array($spec)) { |
117 | 117 | if (isset($spec[ 0 ]) && !is_string($spec[ 0 ])) { |
118 | 118 | foreach ($spec as $s) { |
119 | - self::build($node, [$name => $s]); |
|
119 | + self::build($node, [ $name => $s ]); |
|
120 | 120 | } |
121 | 121 | continue; |
122 | 122 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | |
37 | 37 | $body = $dom->getElementsByTagName('body')->item(0); |
38 | 38 | |
39 | - foreach (['script', 'style'] as $name) { |
|
39 | + foreach ([ 'script', 'style' ] as $name) { |
|
40 | 40 | while ($elem = $body->getElementsByTagName($name)->item(0)) { |
41 | 41 | $elem->parentNode->removeChild($elem); |
42 | 42 | } |
@@ -153,66 +153,66 @@ discard block |
||
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 |
||
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 | } |