@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public function setBirthDay($birthDay) |
| 140 | 140 | { |
| 141 | - $this->birthDay=$birthDay; |
|
| 141 | + $this->birthDay = $birthDay; |
|
| 142 | 142 | return $this; |
| 143 | 143 | } |
| 144 | 144 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | public function setBirthMonth($birthMonth) |
| 161 | 161 | { |
| 162 | - $this->birthMonth=$birthMonth; |
|
| 162 | + $this->birthMonth = $birthMonth; |
|
| 163 | 163 | return $this; |
| 164 | 164 | } |
| 165 | 165 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function setBirthYear($birthYear) |
| 182 | 182 | { |
| 183 | - $this->birthYear=$birthYear; |
|
| 183 | + $this->birthYear = $birthYear; |
|
| 184 | 184 | return $this; |
| 185 | 185 | } |
| 186 | 186 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | public function setEmail($email) |
| 203 | 203 | { |
| 204 | - $this->email = trim((String)$email); |
|
| 204 | + $this->email = trim((String) $email); |
|
| 205 | 205 | return $this; |
| 206 | 206 | } |
| 207 | 207 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | public function setFirstName($firstName) |
| 246 | 246 | { |
| 247 | - $this->firstName = trim((String)$firstName); |
|
| 247 | + $this->firstName = trim((String) $firstName); |
|
| 248 | 248 | return $this; |
| 249 | 249 | } |
| 250 | 250 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | public function setGender($gender) |
| 268 | 268 | { |
| 269 | - $this->gender = trim((String)$gender); |
|
| 269 | + $this->gender = trim((String) $gender); |
|
| 270 | 270 | return $this; |
| 271 | 271 | } |
| 272 | 272 | |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | */ |
| 288 | 288 | public function setHouseNumber($houseNumber) |
| 289 | 289 | { |
| 290 | - $this->houseNumber=$houseNumber; |
|
| 290 | + $this->houseNumber = $houseNumber; |
|
| 291 | 291 | return $this; |
| 292 | 292 | } |
| 293 | 293 | |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | if (!$this->lastName) { |
| 333 | 333 | return $emailIfEmpty ? $this->email : ''; |
| 334 | 334 | } |
| 335 | - return ($this->firstName ? $this->firstName . ' ' : '') . $this->lastName; |
|
| 335 | + return ($this->firstName ? $this->firstName.' ' : '').$this->lastName; |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | /** |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | */ |
| 427 | 427 | public function setStreet($street) |
| 428 | 428 | { |
| 429 | - $this->street=$street; |
|
| 429 | + $this->street = $street; |
|
| 430 | 430 | return $this; |
| 431 | 431 | } |
| 432 | 432 | |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | */ |
| 448 | 448 | public function setCountry($country) |
| 449 | 449 | { |
| 450 | - $this->country=$country; |
|
| 450 | + $this->country = $country; |
|
| 451 | 451 | return $this; |
| 452 | 452 | } |
| 453 | 453 | |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | $name = Inflector::camelize($name); |
| 40 | 40 | $type = $this->elementMap[$name]; |
| 41 | 41 | $locator = $type.' .sf-summary .sf-controls button'; |
| 42 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
| 43 | - if(!$element){ |
|
| 42 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
| 43 | + if (!$element) { |
|
| 44 | 44 | throw new \Exception('No element found with this locator: "'.$locator.'"'); |
| 45 | 45 | } |
| 46 | 46 | $element->click(); |
@@ -70,12 +70,12 @@ discard block |
||
| 70 | 70 | { |
| 71 | 71 | $type = Inflector::camelize($type); |
| 72 | 72 | $method = 'iSave'.$type; |
| 73 | - if(method_exists($this,$method)){ |
|
| 74 | - call_user_func([$this,$method]); |
|
| 75 | - }else{ |
|
| 73 | + if (method_exists($this, $method)) { |
|
| 74 | + call_user_func([$this, $method]); |
|
| 75 | + } else { |
|
| 76 | 76 | $locator = $this->elementMap[$type].'-buttons-submit'; |
| 77 | 77 | $this->coreContext->scrollIntoView($locator); |
| 78 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
| 78 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
| 79 | 79 | $element->click(); |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | $locator = '#nameForm-buttons-submit'; |
| 86 | 86 | $this->coreContext->scrollIntoView($locator); |
| 87 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
| 87 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
| 88 | 88 | $element->click(); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | public function iSaveWorkflow() |
| 95 | 95 | { |
| 96 | 96 | $locator = '#workflowSettings-buttons-submit'; |
| 97 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
| 97 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
| 98 | 98 | $element->click(); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | $locator = '#locationForm-buttons-submit'; |
| 104 | 104 | $this->coreContext->scrollIntoView($locator); |
| 105 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
| 105 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
| 106 | 106 | $element->click(); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | { |
| 112 | 112 | $locator = '#general-classifications-buttons-submit'; |
| 113 | 113 | $this->coreContext->scrollIntoView($locator); |
| 114 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
| 114 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
| 115 | 115 | $element->click(); |
| 116 | 116 | } |
| 117 | 117 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | { |
| 120 | 120 | $locator = '#general-customerNote-buttons-submit'; |
| 121 | 121 | $this->coreContext->scrollIntoView('#sf-general-customerNote'); |
| 122 | - $element = $this->minkContext->getSession()->getPage()->find('css',$locator); |
|
| 122 | + $element = $this->minkContext->getSession()->getPage()->find('css', $locator); |
|
| 123 | 123 | $element->click(); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $core = $scope->getEnvironment()->getContext(CoreContext::class); |
| 50 | 50 | /* @var FileTransport $transport */ |
| 51 | 51 | $transport = $core->getServiceManager()->get('Core/MailService')->getTransport(); |
| 52 | - $path = $transport->getOptions()->getPath() . '/*.eml'; |
|
| 52 | + $path = $transport->getOptions()->getPath().'/*.eml'; |
|
| 53 | 53 | foreach (glob($path) as $filename) { |
| 54 | 54 | unlink($filename); |
| 55 | 55 | } |
@@ -105,25 +105,25 @@ discard block |
||
| 105 | 105 | $regex = '/.*('.preg_quote($text).').*/im'; |
| 106 | 106 | $matches = []; |
| 107 | 107 | $multiMessages = false; |
| 108 | - if(count($this->messages) > 1){ |
|
| 108 | + if (count($this->messages) > 1) { |
|
| 109 | 109 | $multiMessages = true; |
| 110 | 110 | } |
| 111 | 111 | $content = ""; |
| 112 | - foreach($this->messages as $key=>$definition){ |
|
| 112 | + foreach ($this->messages as $key=>$definition) { |
|
| 113 | 113 | $content = $definition['contents']; |
| 114 | - if(preg_match($regex,$content,$match)){ |
|
| 114 | + if (preg_match($regex, $content, $match)) { |
|
| 115 | 115 | $matches[] = $match; |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | - $failMessage = sprintf('Can not find text "%s" in any email sent',$text); |
|
| 119 | - if(!$multiMessages){ |
|
| 118 | + $failMessage = sprintf('Can not find text "%s" in any email sent', $text); |
|
| 119 | + if (!$multiMessages) { |
|
| 120 | 120 | $failMessage = sprintf( |
| 121 | 121 | 'Can not find text "%s" in sent email. Here\'s the email content: %s', |
| 122 | 122 | $text, |
| 123 | 123 | PHP_EOL.PHP_EOL.$content |
| 124 | 124 | ); |
| 125 | 125 | } |
| 126 | - Assert::true(count($matches)>0,$failMessage); |
|
| 126 | + Assert::true(count($matches) > 0, $failMessage); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -136,16 +136,16 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | $path = $transport->getOptions()->getPath().'/*.eml'; |
| 138 | 138 | |
| 139 | - foreach(glob($path) as $filename){ |
|
| 139 | + foreach (glob($path) as $filename) { |
|
| 140 | 140 | $id = md5($filename); |
| 141 | - if(!isset($this->messages[$id])){ |
|
| 141 | + if (!isset($this->messages[$id])) { |
|
| 142 | 142 | $contents = file_get_contents($filename); |
| 143 | - $this->messages[$id] = $this->parseEmail($contents); |
|
| 143 | + $this->messages[$id] = $this->parseEmail($contents); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | Assert::true( |
| 148 | - count($this->messages)>0, |
|
| 148 | + count($this->messages) > 0, |
|
| 149 | 149 | 'No email have been sent' |
| 150 | 150 | ); |
| 151 | 151 | } |
@@ -153,33 +153,33 @@ discard block |
||
| 153 | 153 | private function parseEmail($contents) |
| 154 | 154 | { |
| 155 | 155 | $addresses = $this->parseEmailAddress($contents); |
| 156 | - $subject =$this->parseSubject($contents); |
|
| 156 | + $subject = $this->parseSubject($contents); |
|
| 157 | 157 | |
| 158 | 158 | $contents = strip_tags($contents); |
| 159 | 159 | $contents = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $contents); |
| 160 | 160 | |
| 161 | - return array_merge($addresses,$subject,['contents' => $contents]); |
|
| 161 | + return array_merge($addresses, $subject, ['contents' => $contents]); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | private function parseEmailAddress($contents) |
| 165 | 165 | { |
| 166 | 166 | // pattern to get email address |
| 167 | - $radd = '(\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b)'; |
|
| 167 | + $radd = '(\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b)'; |
|
| 168 | 168 | |
| 169 | 169 | // get email from address |
| 170 | - $regex = sprintf('/^From\:.*%s/im',$radd); |
|
| 171 | - $hasMatch = preg_match($regex,$contents,$matches); |
|
| 172 | - $fromAddress = $hasMatch ? $matches[1]:null; |
|
| 170 | + $regex = sprintf('/^From\:.*%s/im', $radd); |
|
| 171 | + $hasMatch = preg_match($regex, $contents, $matches); |
|
| 172 | + $fromAddress = $hasMatch ? $matches[1] : null; |
|
| 173 | 173 | |
| 174 | 174 | // get email to address |
| 175 | - $regex = sprintf('/^To\:\s+%s/im',$radd); |
|
| 176 | - $hasMatch = preg_match($regex,$contents,$matches); |
|
| 177 | - $toAddress1 = $hasMatch ? $matches[1]:null; |
|
| 175 | + $regex = sprintf('/^To\:\s+%s/im', $radd); |
|
| 176 | + $hasMatch = preg_match($regex, $contents, $matches); |
|
| 177 | + $toAddress1 = $hasMatch ? $matches[1] : null; |
|
| 178 | 178 | |
| 179 | 179 | // get email to address |
| 180 | - $regex = sprintf('/^To\:.*%s/im',$radd); |
|
| 181 | - $hasMatch = preg_match($regex,$contents,$matches); |
|
| 182 | - $toAddress2 = $hasMatch ? $matches[1]:null; |
|
| 180 | + $regex = sprintf('/^To\:.*%s/im', $radd); |
|
| 181 | + $hasMatch = preg_match($regex, $contents, $matches); |
|
| 182 | + $toAddress2 = $hasMatch ? $matches[1] : null; |
|
| 183 | 183 | |
| 184 | 184 | $this->fromMails[] = $fromAddress; |
| 185 | 185 | $this->toMails[] = $toAddress1; |
@@ -187,15 +187,15 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | return [ |
| 189 | 189 | 'from' => $fromAddress, |
| 190 | - 'to' => [$toAddress1,$toAddress2], |
|
| 190 | + 'to' => [$toAddress1, $toAddress2], |
|
| 191 | 191 | ]; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | private function parseSubject($contents) |
| 195 | 195 | { |
| 196 | 196 | $pattern = '/Subject\:(.*)/i'; |
| 197 | - preg_match($pattern,$contents,$matches); |
|
| 198 | - $subject = isset($matches[1]) ? $matches[1]:null; |
|
| 197 | + preg_match($pattern, $contents, $matches); |
|
| 198 | + $subject = isset($matches[1]) ? $matches[1] : null; |
|
| 199 | 199 | $this->subjects[] = $subject; |
| 200 | 200 | return [ |
| 201 | 201 | 'subject' => trim($subject) |
@@ -51,16 +51,16 @@ |
||
| 51 | 51 | $this->summaryFormContext = $scope->getEnvironment()->getContext(SummaryFormContext::class); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - public function buildUrl($name, array $params=array(), array $options=array()) |
|
| 54 | + public function buildUrl($name, array $params = array(), array $options = array()) |
|
| 55 | 55 | { |
| 56 | 56 | $defaults = ['lang'=>'en']; |
| 57 | - $params = array_merge($defaults,$params); |
|
| 57 | + $params = array_merge($defaults, $params); |
|
| 58 | 58 | /* @var Url $urlHelper */ |
| 59 | 59 | $urlHelper = $this |
| 60 | 60 | ->getService('ViewHelperManager') |
| 61 | 61 | ->get('url') |
| 62 | 62 | ; |
| 63 | - $url = $urlHelper($name,$params,$options); |
|
| 63 | + $url = $urlHelper($name, $params, $options); |
|
| 64 | 64 | |
| 65 | 65 | return $this->coreContext->generateUrl($url); |
| 66 | 66 | } |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public function iGoToEmailTemplatePage() |
| 33 | 33 | { |
| 34 | - $url = $this->buildUrl('lang/settings',[ |
|
| 34 | + $url = $this->buildUrl('lang/settings', [ |
|
| 35 | 35 | 'module' => 'Applications' |
| 36 | 36 | ]); |
| 37 | 37 | $this->visit($url); |
@@ -35,13 +35,13 @@ |
||
| 35 | 35 | /* @var $repo JobRepository */ |
| 36 | 36 | $repo = $this->getRepository('Jobs/Job'); |
| 37 | 37 | $job = $repo->findOneBy(['title' => $title]); |
| 38 | - if(!$job instanceof Job){ |
|
| 38 | + if (!$job instanceof Job) { |
|
| 39 | 39 | throw new \Exception('There is no job titled: "'.$title.'"'); |
| 40 | 40 | } |
| 41 | 41 | $job->setApplyId($job->getId()); |
| 42 | 42 | $repo->store($job); |
| 43 | 43 | |
| 44 | - $url = $this->buildUrl('lang/apply',[ |
|
| 44 | + $url = $this->buildUrl('lang/apply', [ |
|
| 45 | 45 | 'applyId' => $job->getApplyId() |
| 46 | 46 | ]); |
| 47 | 47 | $this->visit($url); |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | $repo = static::$jobRepo; |
| 60 | 60 | $results = $repo->findBy(['user' => $user]); |
| 61 | - foreach($results as $result){ |
|
| 62 | - $repo->remove($result,true); |
|
| 61 | + foreach ($results as $result) { |
|
| 62 | + $repo->remove($result, true); |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public function beforeScenario(BeforeScenarioScope $scope) |
| 72 | 72 | { |
| 73 | 73 | $this->select2Context = $scope->getEnvironment()->getContext(Select2Context::class); |
| 74 | - if(is_null(static::$jobRepo)){ |
|
| 74 | + if (is_null(static::$jobRepo)) { |
|
| 75 | 75 | $this->gatherContexts($scope); |
| 76 | 76 | static::$jobRepo = $this->getJobRepository(); |
| 77 | 77 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function iGoToCreateJob() |
| 92 | 92 | { |
| 93 | - $url = $this->buildUrl('lang/jobs/manage',['action' => 'edit']); |
|
| 93 | + $url = $this->buildUrl('lang/jobs/manage', ['action' => 'edit']); |
|
| 94 | 94 | $this->visit($url); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -110,11 +110,11 @@ discard block |
||
| 110 | 110 | public function iGoToEditJobWithTitle($jobTitle) |
| 111 | 111 | { |
| 112 | 112 | $job = $this->getJobRepository()->findOneBy(['title' => $jobTitle]); |
| 113 | - if(!$job instanceof Job){ |
|
| 114 | - throw new \Exception(sprintf('Job with title "%s" is not found',$jobTitle)); |
|
| 113 | + if (!$job instanceof Job) { |
|
| 114 | + throw new \Exception(sprintf('Job with title "%s" is not found', $jobTitle)); |
|
| 115 | 115 | } |
| 116 | 116 | $this->currentJob = $job; |
| 117 | - $url = $this->buildUrl('lang/jobs/manage',[ |
|
| 117 | + $url = $this->buildUrl('lang/jobs/manage', [ |
|
| 118 | 118 | 'id' => $job->getId() |
| 119 | 119 | ]); |
| 120 | 120 | $this->visit($url); |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | $jobRepository = $this->getJobRepository(); |
| 142 | 142 | $results = $jobRepository->getUserJobs($user->getId()); |
| 143 | - foreach($results as $job){ |
|
| 144 | - $jobRepository->remove($job,true); |
|
| 143 | + foreach ($results as $job) { |
|
| 144 | + $jobRepository->remove($job, true); |
|
| 145 | 145 | } |
| 146 | 146 | $this->currentJob = null; |
| 147 | 147 | } |
@@ -150,16 +150,16 @@ discard block |
||
| 150 | 150 | * @When I fill job location search with :search and choose :choice |
| 151 | 151 | * |
| 152 | 152 | */ |
| 153 | - public function iFillJobLocationAndChoose($search,$choice) |
|
| 153 | + public function iFillJobLocationAndChoose($search, $choice) |
|
| 154 | 154 | { |
| 155 | 155 | $select2 = $this->select2Context; |
| 156 | - $select2->iFillInSelect2FieldWith('jobBase[geoLocation]',$search,$choice); |
|
| 156 | + $select2->iFillInSelect2FieldWith('jobBase[geoLocation]', $search, $choice); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | 160 | * @When I choose :value from :field |
| 161 | 161 | */ |
| 162 | - public function iJobClassificationSelect($value,$field) |
|
| 162 | + public function iJobClassificationSelect($value, $field) |
|
| 163 | 163 | { |
| 164 | 164 | $field = Inflector::camelize($field); |
| 165 | 165 | |
@@ -175,18 +175,18 @@ discard block |
||
| 175 | 175 | 'employmentTypes' => "select#classifications-employmentTypes", |
| 176 | 176 | ]; |
| 177 | 177 | |
| 178 | - if(!isset($mapSelect2[$field])){ |
|
| 178 | + if (!isset($mapSelect2[$field])) { |
|
| 179 | 179 | throw new \Exception('Undefined field selection value "'.$field.'"'); |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | $multipleField = $mapMultiple[$field]; |
| 183 | 183 | $page = $this->minkContext->getSession()->getPage(); |
| 184 | - $element = $page->find('css',$mapMultiple[$field]); |
|
| 185 | - if(!is_null($element) && $element->getAttribute('multiple')=='multiple'){ |
|
| 186 | - $this->minkContext->selectOption($value,$multipleField); |
|
| 187 | - }else{ |
|
| 184 | + $element = $page->find('css', $mapMultiple[$field]); |
|
| 185 | + if (!is_null($element) && $element->getAttribute('multiple') == 'multiple') { |
|
| 186 | + $this->minkContext->selectOption($value, $multipleField); |
|
| 187 | + } else { |
|
| 188 | 188 | $locator = $mapSelect2[$field]; |
| 189 | - $this->select2Context->iFillInSelect2Field($locator,$value); |
|
| 189 | + $this->select2Context->iFillInSelect2Field($locator, $value); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
@@ -210,20 +210,20 @@ discard block |
||
| 210 | 210 | * @When I have a :status job with the following: |
| 211 | 211 | * @param TableNode $fields |
| 212 | 212 | */ |
| 213 | - public function iHaveAJobWithTheFollowing($status,TableNode $fields) |
|
| 213 | + public function iHaveAJobWithTheFollowing($status, TableNode $fields) |
|
| 214 | 214 | { |
| 215 | - $this->buildJob($status,$fields->getRowsHash()); |
|
| 215 | + $this->buildJob($status, $fields->getRowsHash()); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - public function buildJob($status, $definitions,$organization = null) |
|
| 218 | + public function buildJob($status, $definitions, $organization = null) |
|
| 219 | 219 | { |
| 220 | 220 | $normalizedField = [ |
| 221 | 221 | 'template' => 'modern', |
| 222 | 222 | ]; |
| 223 | - foreach($definitions as $field => $value){ |
|
| 223 | + foreach ($definitions as $field => $value) { |
|
| 224 | 224 | $field = Inflector::camelize($field); |
| 225 | - if($field == 'professions' || $field == 'industries'){ |
|
| 226 | - $value = explode(',',$value); |
|
| 225 | + if ($field == 'professions' || $field == 'industries') { |
|
| 226 | + $value = explode(',', $value); |
|
| 227 | 227 | } |
| 228 | 228 | $normalizedField[$field] = $value; |
| 229 | 229 | } |
@@ -232,49 +232,49 @@ discard block |
||
| 232 | 232 | $job = $jobRepo->findOneBy([ |
| 233 | 233 | 'title' => $normalizedField['title'] |
| 234 | 234 | ]); |
| 235 | - if(!$job instanceof Job){ |
|
| 235 | + if (!$job instanceof Job) { |
|
| 236 | 236 | $job = new Job(); |
| 237 | 237 | $job->setTitle($normalizedField['title']); |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - if(isset($normalizedField['user'])){ |
|
| 240 | + if (isset($normalizedField['user'])) { |
|
| 241 | 241 | /* @var $userRepo UserRepository */ |
| 242 | 242 | $userRepo = $this->getRepository('Auth\Entity\User'); |
| 243 | 243 | $user = $userRepo->findOneBy(['login' => $normalizedField['user']]); |
| 244 | - if(is_null($organization)){ |
|
| 244 | + if (is_null($organization)) { |
|
| 245 | 245 | $organization = $user->getOrganization()->getOrganization(); |
| 246 | 246 | } |
| 247 | - if($user instanceof User){ |
|
| 247 | + if ($user instanceof User) { |
|
| 248 | 248 | $job->setUser($user); |
| 249 | 249 | $job->setOrganization($organization); |
| 250 | - }else{ |
|
| 250 | + } else { |
|
| 251 | 251 | throw new \Exception('There is no user with this login:"'.$normalizedField['user'.'"']); |
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - if($status == 'draft'){ |
|
| 255 | + if ($status == 'draft') { |
|
| 256 | 256 | $job->setIsDraft(true); |
| 257 | - }elseif($status == 'published'){ |
|
| 257 | + }elseif ($status == 'published') { |
|
| 258 | 258 | $job->setIsDraft(false); |
| 259 | 259 | $job->setDatePublishStart(new \DateTime()); |
| 260 | 260 | } |
| 261 | 261 | $job->setStatus(Status::ACTIVE); |
| 262 | 262 | |
| 263 | - if(isset($normalizedField['location'])){ |
|
| 264 | - $this->setLocation($job,$normalizedField['location']); |
|
| 263 | + if (isset($normalizedField['location'])) { |
|
| 264 | + $this->setLocation($job, $normalizedField['location']); |
|
| 265 | 265 | } |
| 266 | - if(isset($normalizedField['professions'])){ |
|
| 267 | - $this->addProfessions($job,$normalizedField['professions']); |
|
| 266 | + if (isset($normalizedField['professions'])) { |
|
| 267 | + $this->addProfessions($job, $normalizedField['professions']); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - if(isset($normalizedField['industries'])){ |
|
| 271 | - $this->addIndustries($job,$normalizedField['industries']); |
|
| 270 | + if (isset($normalizedField['industries'])) { |
|
| 271 | + $this->addIndustries($job, $normalizedField['industries']); |
|
| 272 | 272 | } |
| 273 | - if(isset($normalizedField['employmentTypes'])){ |
|
| 273 | + if (isset($normalizedField['employmentTypes'])) { |
|
| 274 | 274 | $types = $this->getCategories([$normalizedField['employmentTypes']]); |
| 275 | 275 | $type = array_shift($types); |
| 276 | 276 | $values = $job->getClassifications()->getEmploymentTypes()->getValues(); |
| 277 | - if(!is_array($values) || !in_array($type,$values)){ |
|
| 277 | + if (!is_array($values) || !in_array($type, $values)) { |
|
| 278 | 278 | $job->getClassifications()->getEmploymentTypes()->getItems()->add($type); |
| 279 | 279 | } |
| 280 | 280 | } |
@@ -294,18 +294,18 @@ discard block |
||
| 294 | 294 | $location->fromString($serialized); |
| 295 | 295 | |
| 296 | 296 | $locations = $job->getLocations(); |
| 297 | - if(count($locations)){ |
|
| 297 | + if (count($locations)) { |
|
| 298 | 298 | $locations->clear(); |
| 299 | 299 | } |
| 300 | 300 | $job->getLocations()->add($location); |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - private function addProfessions(Job &$job,$terms) |
|
| 303 | + private function addProfessions(Job &$job, $terms) |
|
| 304 | 304 | { |
| 305 | 305 | $professions = $this->getCategories($terms); |
| 306 | - foreach($professions as $profession){ |
|
| 306 | + foreach ($professions as $profession) { |
|
| 307 | 307 | $values = $job->getClassifications()->getProfessions()->getValues(); |
| 308 | - if(!is_array($values) || !in_array($profession,$values)){ |
|
| 308 | + if (!is_array($values) || !in_array($profession, $values)) { |
|
| 309 | 309 | $job->getClassifications()->getProfessions()->getItems()->add($profession); |
| 310 | 310 | } |
| 311 | 311 | } |
@@ -314,9 +314,9 @@ discard block |
||
| 314 | 314 | private function addIndustries(Job &$job, $terms) |
| 315 | 315 | { |
| 316 | 316 | $industries = $this->getCategories($terms); |
| 317 | - foreach($industries as $industry){ |
|
| 317 | + foreach ($industries as $industry) { |
|
| 318 | 318 | $values = $job->getClassifications()->getIndustries()->getValues(); |
| 319 | - if(!is_array($values) || !in_array($industry,$values)){ |
|
| 319 | + if (!is_array($values) || !in_array($industry, $values)) { |
|
| 320 | 320 | $job->getClassifications()->getIndustries()->getItems()->add($industry); |
| 321 | 321 | } |
| 322 | 322 | } |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | |
| 352 | 352 | $job = $repo->findDraft($user); |
| 353 | 353 | |
| 354 | - if(is_null($job)){ |
|
| 354 | + if (is_null($job)) { |
|
| 355 | 355 | $job = new Job(); |
| 356 | 356 | $job |
| 357 | 357 | ->setUser($user) |
@@ -103,9 +103,9 @@ discard block |
||
| 103 | 103 | public function iHaveOrganization($name) |
| 104 | 104 | { |
| 105 | 105 | $user = $this->getUserContext()->getCurrentUser(); |
| 106 | - $organization = $this->findOrganizationByName($name,false); |
|
| 106 | + $organization = $this->findOrganizationByName($name, false); |
|
| 107 | 107 | $repo = $this->getRepository('Organizations/Organization'); |
| 108 | - if(!$organization instanceof Organization){ |
|
| 108 | + if (!$organization instanceof Organization) { |
|
| 109 | 109 | |
| 110 | 110 | $organization = new Organization(); |
| 111 | 111 | $organizationName = new OrganizationName($name); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $organization->setParent($parent); |
| 119 | 119 | $organization->setProfileSetting(Organization::PROFILE_ALWAYS_ENABLE); |
| 120 | 120 | $permissions = $organization->getPermissions(); |
| 121 | - $permissions->grant($user,Permissions::PERMISSION_ALL); |
|
| 121 | + $permissions->grant($user, Permissions::PERMISSION_ALL); |
|
| 122 | 122 | |
| 123 | 123 | $repo->store($organization); |
| 124 | 124 | $repo->getDocumentManager()->refresh($organization); |
@@ -128,19 +128,19 @@ discard block |
||
| 128 | 128 | /** |
| 129 | 129 | * @Given organization :name have jobs: |
| 130 | 130 | */ |
| 131 | - public function organizationHavePublishedJob($name,TableNode $table) |
|
| 131 | + public function organizationHavePublishedJob($name, TableNode $table) |
|
| 132 | 132 | { |
| 133 | 133 | $user = $this->getUserContext()->getCurrentUser(); |
| 134 | - if(is_null($user)){ |
|
| 134 | + if (is_null($user)) { |
|
| 135 | 135 | throw new FailedExpectationException('Need to login first'); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | $organization = $this->findOrganizationByName($name); |
| 139 | - foreach($table->getColumnsHash() as $index=>$definitions){ |
|
| 139 | + foreach ($table->getColumnsHash() as $index=>$definitions) { |
|
| 140 | 140 | $definitions['user'] = $user->getLogin(); |
| 141 | - $status = isset($definitions['status']) ? $definitions['status']:'draft'; |
|
| 141 | + $status = isset($definitions['status']) ? $definitions['status'] : 'draft'; |
|
| 142 | 142 | unset($definitions['status']); |
| 143 | - $this->jobContext->buildJob($status,$definitions,$organization); |
|
| 143 | + $this->jobContext->buildJob($status, $definitions, $organization); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * @param $name |
| 150 | 150 | * @param $setting |
| 151 | 151 | */ |
| 152 | - public function profileSetting($name,$setting) |
|
| 152 | + public function profileSetting($name, $setting) |
|
| 153 | 153 | { |
| 154 | 154 | $repo = $this->getRepository('Organizations/Organization'); |
| 155 | 155 | $organization = $this->findOrganizationByName($name); |
@@ -169,12 +169,12 @@ discard block |
||
| 169 | 169 | $contact = $organization->getContact(); |
| 170 | 170 | |
| 171 | 171 | $definitions = $table->getRowsHash(); |
| 172 | - foreach($definitions as $name=>$value){ |
|
| 172 | + foreach ($definitions as $name=>$value) { |
|
| 173 | 173 | $field = Inflector::camelize($name); |
| 174 | 174 | $method = 'set'.$field; |
| 175 | - $callback = array($contact,$method); |
|
| 176 | - if(is_callable($callback)){ |
|
| 177 | - call_user_func_array($callback,[$value]); |
|
| 175 | + $callback = array($contact, $method); |
|
| 176 | + if (is_callable($callback)) { |
|
| 177 | + call_user_func_array($callback, [$value]); |
|
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | 180 | $this->getRepository('Organizations/Organization')->store($organization); |
@@ -186,14 +186,14 @@ discard block |
||
| 186 | 186 | * @param string $name |
| 187 | 187 | * @throws FailedExpectationException |
| 188 | 188 | */ |
| 189 | - public function iGoToOrganizationProfilePage($name=null) |
|
| 189 | + public function iGoToOrganizationProfilePage($name = null) |
|
| 190 | 190 | { |
| 191 | - if(is_null($name)){ |
|
| 191 | + if (is_null($name)) { |
|
| 192 | 192 | $organization = $this->getUserContext()->getCurrentUser()->getOrganization()->getOrganization(); |
| 193 | - }else{ |
|
| 193 | + } else { |
|
| 194 | 194 | $organization = $this->findOrganizationByName($name); |
| 195 | 195 | } |
| 196 | - $url = $this->buildUrl('lang/organizations/profileDetail',[ |
|
| 196 | + $url = $this->buildUrl('lang/organizations/profileDetail', [ |
|
| 197 | 197 | 'id' => $organization->getId() |
| 198 | 198 | ]); |
| 199 | 199 | |
@@ -210,10 +210,10 @@ discard block |
||
| 210 | 210 | /* @var OrganizationRepository $repo */ |
| 211 | 211 | $repo = $this->getRepository('Organizations/Organization'); |
| 212 | 212 | $result = $repo->findByName($name); |
| 213 | - $organization = count($result) > 0 ? $result[0]:null; |
|
| 214 | - if(!$organization instanceof Organization && $throwException){ |
|
| 213 | + $organization = count($result) > 0 ? $result[0] : null; |
|
| 214 | + if (!$organization instanceof Organization && $throwException) { |
|
| 215 | 215 | throw new FailedExpectationException( |
| 216 | - sprintf('Organization %s is not found.',$name) |
|
| 216 | + sprintf('Organization %s is not found.', $name) |
|
| 217 | 217 | ); |
| 218 | 218 | } |
| 219 | 219 | return $organization; |
@@ -232,8 +232,8 @@ discard block |
||
| 232 | 232 | $jobRepo = $this->getRepository('Jobs/Job'); |
| 233 | 233 | $result = $jobRepo->findByOrganization($org->getId()); |
| 234 | 234 | |
| 235 | - foreach($result as $job){ |
|
| 236 | - $jobRepo->remove($job,true); |
|
| 235 | + foreach ($result as $job) { |
|
| 236 | + $jobRepo->remove($job, true); |
|
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | 239 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | { |
| 245 | 245 | $user = $this->getUserContext()->getCurrentUser(); |
| 246 | 246 | $organization = $user->getOrganization()->getOrganization(); |
| 247 | - $url = $this->buildUrl('lang/organizations/edit',['id' => $organization->getId()]); |
|
| 247 | + $url = $this->buildUrl('lang/organizations/edit', ['id' => $organization->getId()]); |
|
| 248 | 248 | $this->visit($url); |
| 249 | 249 | } |
| 250 | 250 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | public function iAttachLogoFromFile($file) |
| 256 | 256 | { |
| 257 | 257 | $elementId = 'organizationLogo-original'; |
| 258 | - $this->minkContext->attachFileToField($elementId,$file); |
|
| 258 | + $this->minkContext->attachFileToField($elementId, $file); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | public function iRemoveLogoFromOrganization() |
| 265 | 265 | { |
| 266 | 266 | $elementId = '#organizationLogo-original-delete'; |
| 267 | - $element = $this->minkContext->getSession()->getPage()->find('css',$elementId); |
|
| 267 | + $element = $this->minkContext->getSession()->getPage()->find('css', $elementId); |
|
| 268 | 268 | $element->click(); |
| 269 | 269 | } |
| 270 | 270 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * @see \Core\Repository\AbstractRepository::create() |
| 95 | 95 | * @return UserInterface |
| 96 | 96 | */ |
| 97 | - public function create(array $data = null, $persist=false) |
|
| 97 | + public function create(array $data = null, $persist = false) |
|
| 98 | 98 | { |
| 99 | 99 | $entity = parent::create($data); |
| 100 | 100 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function findByProfileIdentifier($identifier, $provider, array $options = []) |
| 118 | 118 | { |
| 119 | - return $this->findOneBy(array('profiles.' . $provider . '.auth.identifier' => $identifier), $options) ?: $this->findOneBy(array('profile.identifier' => $identifier), $options); |
|
| 119 | + return $this->findOneBy(array('profiles.'.$provider.'.auth.identifier' => $identifier), $options) ?: $this->findOneBy(array('profile.identifier' => $identifier), $options); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $qb->field('_id')->notEqual($curentUserId) |
| 134 | 134 | ->addAnd( |
| 135 | 135 | $qb->expr() |
| 136 | - ->addOr($qb->expr()->field('profiles.' . $provider . '.auth.identifier' )->equals($identifier)) |
|
| 136 | + ->addOr($qb->expr()->field('profiles.'.$provider.'.auth.identifier')->equals($identifier)) |
|
| 137 | 137 | ->addOr($qb->expr()->field('profile.identifier')->equals($identifier)) |
| 138 | 138 | ); |
| 139 | 139 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | return $this->findOneBy( |
| 190 | 190 | array( |
| 191 | 191 | '$or' => array( |
| 192 | - array('login' => $identity . $suffix), |
|
| 192 | + array('login' => $identity.$suffix), |
|
| 193 | 193 | array('info.email' => $identity) |
| 194 | 194 | ) |
| 195 | 195 | ) |
@@ -238,10 +238,10 @@ discard block |
||
| 238 | 238 | public function findByQuery($query) |
| 239 | 239 | { |
| 240 | 240 | $qb = $this->createQueryBuilder(); |
| 241 | - $parts = explode(' ', trim($query)); |
|
| 241 | + $parts = explode(' ', trim($query)); |
|
| 242 | 242 | |
| 243 | 243 | foreach ($parts as $q) { |
| 244 | - $regex = new \MongoRegex('/^' . $query . '/i'); |
|
| 244 | + $regex = new \MongoRegex('/^'.$query.'/i'); |
|
| 245 | 245 | $qb->addOr($qb->expr()->field('info.firstName')->equals($regex)); |
| 246 | 246 | $qb->addOr($qb->expr()->field('info.lastName')->equals($regex)); |
| 247 | 247 | $qb->addOr($qb->expr()->field('info.email')->equals($regex)); |