@@ -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; |
@@ -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 | } |