@@ -151,109 +151,109 @@ |
||
151 | 151 | * |
152 | 152 | * @return string |
153 | 153 | */ |
154 | - public function transform(JobInterface $job, $options = []) |
|
154 | + public function transform(JobInterface $job, $options = [ ]) |
|
155 | 155 | { |
156 | 156 | $applyUrl = $this->getApplyUrlHelper(); |
157 | 157 | $serverUrl = $this->getServerUrlHelper(); |
158 | 158 | $imageManager = $this->getOrganizationImageManager(); |
159 | 159 | |
160 | 160 | $jobSpec = [ |
161 | - 'action' => isset($options['action']) ? $options['action'] : 'post', |
|
161 | + 'action' => isset($options[ 'action' ]) ? $options[ 'action' ] : 'post', |
|
162 | 162 | //'test' => 'true', |
163 | 163 | |
164 | 164 | ]; |
165 | 165 | |
166 | - if (isset($options['externalId'])) { |
|
167 | - $jobSpec['jobid'] = $options['externalId']; |
|
166 | + if (isset($options[ 'externalId' ])) { |
|
167 | + $jobSpec[ 'jobid' ] = $options[ 'externalId' ]; |
|
168 | 168 | } |
169 | 169 | |
170 | - $jobSpec[':title'] = $job->getTitle(); |
|
171 | - $jobSpec[':company'] = $job->getOrganization()->getOrganizationName()->getName(); |
|
172 | - $jobSpec[':companyurl'] = $job->getOrganization()->getContact()->getWebsite() ?: ''; |
|
170 | + $jobSpec[ ':title' ] = $job->getTitle(); |
|
171 | + $jobSpec[ ':company' ] = $job->getOrganization()->getOrganizationName()->getName(); |
|
172 | + $jobSpec[ ':companyurl' ] = $job->getOrganization()->getContact()->getWebsite() ?: ''; |
|
173 | 173 | |
174 | 174 | if (($image = $job->getOrganization()->getImage()) && $serverUrl && $imageManager) { |
175 | 175 | $imageUri = $imageManager->getUri($image); |
176 | - $jobSpec['logourl'] = $serverUrl($imageUri); |
|
176 | + $jobSpec[ 'logourl' ] = $serverUrl($imageUri); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | if ($companyDesc = $job->getOrganization()->getDescription()) { |
180 | - $jobSpec[':aboutcompany'] = $companyDesc; |
|
180 | + $jobSpec[ ':aboutcompany' ] = $companyDesc; |
|
181 | 181 | } |
182 | 182 | |
183 | - $jobSpec['vendorid'] = $job->getId(); |
|
183 | + $jobSpec[ 'vendorid' ] = $job->getId(); |
|
184 | 184 | |
185 | 185 | $atsMode = $job->getAtsMode(); |
186 | 186 | if ($atsMode->isDisabled()) { |
187 | - $jobSpec['howtoapply'] = 'postalisch'; |
|
187 | + $jobSpec[ 'howtoapply' ] = 'postalisch'; |
|
188 | 188 | } else if ($atsMode->isEmail()) { |
189 | - $jobSpec['howtoapply'] = $atsMode->getEmail(); |
|
189 | + $jobSpec[ 'howtoapply' ] = $atsMode->getEmail(); |
|
190 | 190 | } else if ($atsMode->isUri()) { |
191 | - $jobSpec['howtoapply'] = $atsMode->getUri(); |
|
191 | + $jobSpec[ 'howtoapply' ] = $atsMode->getUri(); |
|
192 | 192 | } else if (is_callable($applyUrl) && $serverUrl) { |
193 | - $jobSpec['howtoapply'] = $serverUrl($applyUrl($job, ['linkOnly' => true, 'absolute' => true])); |
|
193 | + $jobSpec[ 'howtoapply' ] = $serverUrl($applyUrl($job, [ 'linkOnly' => true, 'absolute' => true ])); |
|
194 | 194 | } else { |
195 | - $jobSpec['howtoapply'] = 'postalisch'; |
|
195 | + $jobSpec[ 'howtoapply' ] = 'postalisch'; |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
199 | 199 | |
200 | 200 | $locations = $job->getLocations(); |
201 | 201 | if ($locations->count()) { |
202 | - $loc = []; |
|
202 | + $loc = [ ]; |
|
203 | 203 | |
204 | 204 | foreach ($locations as $location) { |
205 | - $loc[] = ['location' => (string) $location]; |
|
205 | + $loc[ ] = [ 'location' => (string) $location ]; |
|
206 | 206 | } |
207 | 207 | |
208 | - $jobSpec['locations'] = $loc; |
|
208 | + $jobSpec[ 'locations' ] = $loc; |
|
209 | 209 | } |
210 | 210 | |
211 | - foreach (['topspot', 'featured', 'remote', 'relocation', 'visasponsorship', 'sysadmin'] as $boolOpt) { |
|
212 | - if (isset($options[$boolOpt])) { |
|
213 | - $jobSpec[$boolOpt] = $options[$boolOpt] ? 'true' : 'false'; |
|
211 | + foreach ([ 'topspot', 'featured', 'remote', 'relocation', 'visasponsorship', 'sysadmin' ] as $boolOpt) { |
|
212 | + if (isset($options[ $boolOpt ])) { |
|
213 | + $jobSpec[ $boolOpt ] = $options[ $boolOpt ] ? 'true' : 'false'; |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | - foreach (['length', 'coupon', 'pixel'] as $strOpt) { |
|
218 | - if (isset($options[$strOpt])) { |
|
219 | - $jobSpec[$strOpt] = $options[$strOpt]; |
|
217 | + foreach ([ 'length', 'coupon', 'pixel' ] as $strOpt) { |
|
218 | + if (isset($options[ $strOpt ])) { |
|
219 | + $jobSpec[ $strOpt ] = $options[ $strOpt ]; |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | |
223 | 223 | $link = $job->getLink(); |
224 | - $jobSpec[':description'] = $link ? $this->getDescriptionFilter()->filter($link) : '<p></p>'; |
|
224 | + $jobSpec[ ':description' ] = $link ? $this->getDescriptionFilter()->filter($link) : '<p></p>'; |
|
225 | 225 | |
226 | 226 | if ($requirements = $job->getTemplateValues()->getRequirements()) { |
227 | - $jobSpec[':requirements'] = $requirements; |
|
227 | + $jobSpec[ ':requirements' ] = $requirements; |
|
228 | 228 | } |
229 | 229 | |
230 | - $tags = []; |
|
231 | - if (isset($options['keywords']) && is_array($options['keyword'])) { |
|
232 | - foreach ($options['keywords'] as $keyword) { |
|
233 | - $tags[] = ['tag' => $keyword]; |
|
230 | + $tags = [ ]; |
|
231 | + if (isset($options[ 'keywords' ]) && is_array($options[ 'keyword' ])) { |
|
232 | + foreach ($options[ 'keywords' ] as $keyword) { |
|
233 | + $tags[ ] = [ 'tag' => $keyword ]; |
|
234 | 234 | } |
235 | 235 | } else { |
236 | - $tags[] = ['tag' => 'none']; |
|
236 | + $tags[ ] = [ 'tag' => 'none' ]; |
|
237 | 237 | } |
238 | - $jobSpec['tags'] = $tags; |
|
238 | + $jobSpec[ 'tags' ] = $tags; |
|
239 | 239 | |
240 | - if (isset($options['advertisingregions']) && is_array($options['advertisingregions'])) { |
|
241 | - $regions = []; |
|
242 | - foreach ($options['advertisingregions'] as $adreg) { |
|
243 | - $regions[] = ['regioncode' => $adreg]; |
|
240 | + if (isset($options[ 'advertisingregions' ]) && is_array($options[ 'advertisingregions' ])) { |
|
241 | + $regions = [ ]; |
|
242 | + foreach ($options[ 'advertisingregions' ] as $adreg) { |
|
243 | + $regions[ ] = [ 'regioncode' => $adreg ]; |
|
244 | 244 | } |
245 | - $jobSpec['advertisingregions'] = $regions; |
|
245 | + $jobSpec[ 'advertisingregions' ] = $regions; |
|
246 | 246 | } |
247 | 247 | |
248 | - if (isset($options['advertisingcountries']) && is_array($options['advertisingcountries'])) { |
|
249 | - $countries = []; |
|
250 | - foreach ($options['advertisingcountries'] as $adcountry) { |
|
251 | - $countries[] = ['regioncode' => $adcountry]; |
|
248 | + if (isset($options[ 'advertisingcountries' ]) && is_array($options[ 'advertisingcountries' ])) { |
|
249 | + $countries = [ ]; |
|
250 | + foreach ($options[ 'advertisingcountries' ] as $adcountry) { |
|
251 | + $countries[ ] = [ 'regioncode' => $adcountry ]; |
|
252 | 252 | } |
253 | - $jobSpec['advertisingcountrycodes'] = $countries; |
|
253 | + $jobSpec[ 'advertisingcountrycodes' ] = $countries; |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | |
257 | - return XmlBuilder::createXml(['job' => $jobSpec]); |
|
257 | + return XmlBuilder::createXml([ 'job' => $jobSpec ]); |
|
258 | 258 | } |
259 | 259 | } |