@@ -82,7 +82,7 @@ |
||
82 | 82 | * ], |
83 | 83 | * ] |
84 | 84 | * |
85 | - * @param \DOMDocument|\DOMElement $node |
|
85 | + * @param \DOMDocument $node |
|
86 | 86 | * @param array $specs |
87 | 87 | */ |
88 | 88 | private static function build($node, array $specs) |
@@ -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 | } |
@@ -151,117 +151,117 @@ |
||
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 | - $l = []; |
|
206 | - $l['location'] = $location->getCity(); |
|
205 | + $l = [ ]; |
|
206 | + $l[ 'location' ] = $location->getCity(); |
|
207 | 207 | $coords = $location->getCoordinates(); |
208 | 208 | if (CoordinatesInterface::TYPE_POINT == $coords->getType()) { |
209 | 209 | $c = $coords->getCoordinates(); |
210 | - $l['location']['@lon'] = $c[0]; |
|
211 | - $l['location']['@lat'] = $c[1]; |
|
210 | + $l[ 'location' ][ '@lon' ] = $c[ 0 ]; |
|
211 | + $l[ 'location' ][ '@lat' ] = $c[ 1 ]; |
|
212 | 212 | } |
213 | - $loc[] = $l; |
|
213 | + $loc[ ] = $l; |
|
214 | 214 | } |
215 | 215 | |
216 | - $jobSpec['locations'] = $loc; |
|
216 | + $jobSpec[ 'locations' ] = $loc; |
|
217 | 217 | } |
218 | 218 | |
219 | - foreach (['topspot', 'featured', 'remote', 'relocation', 'visasponsorship', 'sysadmin'] as $boolOpt) { |
|
220 | - if (isset($options[$boolOpt])) { |
|
221 | - $jobSpec[$boolOpt] = $options[$boolOpt] ? 'true' : 'false'; |
|
219 | + foreach ([ 'topspot', 'featured', 'remote', 'relocation', 'visasponsorship', 'sysadmin' ] as $boolOpt) { |
|
220 | + if (isset($options[ $boolOpt ])) { |
|
221 | + $jobSpec[ $boolOpt ] = $options[ $boolOpt ] ? 'true' : 'false'; |
|
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
225 | - foreach (['length', 'coupon', 'pixel'] as $strOpt) { |
|
226 | - if (isset($options[$strOpt])) { |
|
227 | - $jobSpec[$strOpt] = $options[$strOpt]; |
|
225 | + foreach ([ 'length', 'coupon', 'pixel' ] as $strOpt) { |
|
226 | + if (isset($options[ $strOpt ])) { |
|
227 | + $jobSpec[ $strOpt ] = $options[ $strOpt ]; |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
231 | 231 | $link = $job->getLink(); |
232 | - $jobSpec[':description'] = $link ? $this->getDescriptionFilter()->filter($link) : '<p></p>'; |
|
232 | + $jobSpec[ ':description' ] = $link ? $this->getDescriptionFilter()->filter($link) : '<p></p>'; |
|
233 | 233 | |
234 | 234 | if ($requirements = $job->getTemplateValues()->getRequirements()) { |
235 | - $jobSpec[':requirements'] = $requirements; |
|
235 | + $jobSpec[ ':requirements' ] = $requirements; |
|
236 | 236 | } |
237 | 237 | |
238 | - $tags = []; |
|
239 | - if (isset($options['keywords']) && is_array($options['keyword'])) { |
|
240 | - foreach ($options['keywords'] as $keyword) { |
|
241 | - $tags[] = ['tag' => $keyword]; |
|
238 | + $tags = [ ]; |
|
239 | + if (isset($options[ 'keywords' ]) && is_array($options[ 'keyword' ])) { |
|
240 | + foreach ($options[ 'keywords' ] as $keyword) { |
|
241 | + $tags[ ] = [ 'tag' => $keyword ]; |
|
242 | 242 | } |
243 | 243 | } else { |
244 | - $tags[] = ['tag' => 'none']; |
|
244 | + $tags[ ] = [ 'tag' => 'none' ]; |
|
245 | 245 | } |
246 | - $jobSpec['tags'] = $tags; |
|
246 | + $jobSpec[ 'tags' ] = $tags; |
|
247 | 247 | |
248 | - if (isset($options['advertisingregions']) && is_array($options['advertisingregions'])) { |
|
249 | - $regions = []; |
|
250 | - foreach ($options['advertisingregions'] as $adreg) { |
|
251 | - $regions[] = ['regioncode' => $adreg]; |
|
248 | + if (isset($options[ 'advertisingregions' ]) && is_array($options[ 'advertisingregions' ])) { |
|
249 | + $regions = [ ]; |
|
250 | + foreach ($options[ 'advertisingregions' ] as $adreg) { |
|
251 | + $regions[ ] = [ 'regioncode' => $adreg ]; |
|
252 | 252 | } |
253 | - $jobSpec['advertisingregions'] = $regions; |
|
253 | + $jobSpec[ 'advertisingregions' ] = $regions; |
|
254 | 254 | } |
255 | 255 | |
256 | - if (isset($options['advertisingcountries']) && is_array($options['advertisingcountries'])) { |
|
257 | - $countries = []; |
|
258 | - foreach ($options['advertisingcountries'] as $adcountry) { |
|
259 | - $countries[] = ['regioncode' => $adcountry]; |
|
256 | + if (isset($options[ 'advertisingcountries' ]) && is_array($options[ 'advertisingcountries' ])) { |
|
257 | + $countries = [ ]; |
|
258 | + foreach ($options[ 'advertisingcountries' ] as $adcountry) { |
|
259 | + $countries[ ] = [ 'regioncode' => $adcountry ]; |
|
260 | 260 | } |
261 | - $jobSpec['advertisingcountrycodes'] = $countries; |
|
261 | + $jobSpec[ 'advertisingcountrycodes' ] = $countries; |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
265 | - return XmlBuilder::createXml(['job' => $jobSpec]); |
|
265 | + return XmlBuilder::createXml([ 'job' => $jobSpec ]); |
|
266 | 266 | } |
267 | 267 | } |