@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | private $loggedInUser; |
| 71 | 71 | |
| 72 | - public function __construct($parameters=[]) |
|
| 72 | + public function __construct($parameters = []) |
|
| 73 | 73 | { |
| 74 | 74 | $defaultLoginInfo = [ |
| 75 | 75 | 'facebook' => [ |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | 'session_password-login' => getenv('LINKEDIN_USER_PASSWORD') |
| 82 | 82 | ], |
| 83 | 83 | ]; |
| 84 | - $socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info']:[]; |
|
| 85 | - $this->socialLoginInfo = array_merge($defaultLoginInfo,$socialLoginConfig); |
|
| 84 | + $socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info'] : []; |
|
| 85 | + $this->socialLoginInfo = array_merge($defaultLoginInfo, $socialLoginConfig); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | static public function afterSuite(AfterSuiteScope $scope) |
| 93 | 93 | { |
| 94 | 94 | $repo = static::$userRepo; |
| 95 | - foreach(static::$users as $user){ |
|
| 96 | - if($repo->findByLogin($user->getLogin())){ |
|
| 97 | - try{ |
|
| 95 | + foreach (static::$users as $user) { |
|
| 96 | + if ($repo->findByLogin($user->getLogin())) { |
|
| 97 | + try { |
|
| 98 | 98 | JobContext::removeJobByUser($user); |
| 99 | - $repo->remove($user,true); |
|
| 100 | - }catch (\Exception $e){ |
|
| 99 | + $repo->remove($user, true); |
|
| 100 | + } catch (\Exception $e) { |
|
| 101 | 101 | |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | { |
| 131 | 131 | $provider = strtolower($provider); |
| 132 | 132 | $mink = $this->minkContext; |
| 133 | - foreach($this->socialLoginInfo[$provider] as $field=>$value){ |
|
| 134 | - $mink->fillField($field,$value); |
|
| 133 | + foreach ($this->socialLoginInfo[$provider] as $field=>$value) { |
|
| 134 | + $mink->fillField($field, $value); |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
@@ -139,15 +139,15 @@ discard block |
||
| 139 | 139 | * @Given I am logged in as a recruiter |
| 140 | 140 | * @Given I am logged in as a recruiter with :organization as organization |
| 141 | 141 | */ |
| 142 | - public function iAmLoggedInAsARecruiter($organization=null) |
|
| 142 | + public function iAmLoggedInAsARecruiter($organization = null) |
|
| 143 | 143 | { |
| 144 | 144 | $user = $this->thereIsAUserIdentifiedBy( |
| 145 | 145 | '[email protected]', |
| 146 | - 'test',User::ROLE_RECRUITER, |
|
| 146 | + 'test', User::ROLE_RECRUITER, |
|
| 147 | 147 | 'Test Recruiter', |
| 148 | 148 | $organization |
| 149 | 149 | ); |
| 150 | - $this->startLogin($user,'test'); |
|
| 150 | + $this->startLogin($user, 'test'); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
@@ -157,9 +157,9 @@ discard block |
||
| 157 | 157 | public function iDonTHaveUser($login) |
| 158 | 158 | { |
| 159 | 159 | $repo = $this->getUserRepository(); |
| 160 | - $user=$repo->findByLogin($login); |
|
| 161 | - if($user instanceof UserInterface){ |
|
| 162 | - $repo->remove($user,true); |
|
| 160 | + $user = $repo->findByLogin($login); |
|
| 161 | + if ($user instanceof UserInterface) { |
|
| 162 | + $repo->remove($user, true); |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | * @param $role |
| 169 | 169 | * @param TableNode $fields |
| 170 | 170 | */ |
| 171 | - public function iHaveUserWithTheFollowing($role,TableNode $fields) |
|
| 171 | + public function iHaveUserWithTheFollowing($role, TableNode $fields) |
|
| 172 | 172 | { |
| 173 | 173 | $normalizedFields = [ |
| 174 | 174 | 'login' => '[email protected]', |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | 'password' => 'test', |
| 178 | 178 | 'organization' => 'Cross Solution' |
| 179 | 179 | ]; |
| 180 | - foreach($fields->getRowsHash() as $field=>$value){ |
|
| 180 | + foreach ($fields->getRowsHash() as $field=>$value) { |
|
| 181 | 181 | $field = Inflector::camelize($field); |
| 182 | 182 | $normalizedFields[$field] = $value; |
| 183 | 183 | } |
@@ -197,14 +197,14 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | public function iAmLoggedInAsAnAdmin() |
| 199 | 199 | { |
| 200 | - $user = $this->thereIsAUserIdentifiedBy('[email protected]','test',User::ROLE_ADMIN); |
|
| 201 | - $this->startLogin($user,'test'); |
|
| 200 | + $user = $this->thereIsAUserIdentifiedBy('[email protected]', 'test', User::ROLE_ADMIN); |
|
| 201 | + $this->startLogin($user, 'test'); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | private function startLogin(UserInterface $user, $password) |
| 205 | 205 | { |
| 206 | 206 | $currentUser = $this->currentUser; |
| 207 | - if(!is_object($currentUser) || $user->getId()!=$currentUser->getId()){ |
|
| 207 | + if (!is_object($currentUser) || $user->getId() != $currentUser->getId()) { |
|
| 208 | 208 | $this->iWantToLogIn(); |
| 209 | 209 | $this->iSpecifyTheUsernameAs($user->getLogin()); |
| 210 | 210 | $this->iSpecifyThePasswordAs($password); |
@@ -224,15 +224,15 @@ discard block |
||
| 224 | 224 | /** |
| 225 | 225 | * @Given there is a user :email identified by :password |
| 226 | 226 | */ |
| 227 | - public function thereIsAUserIdentifiedBy($email, $password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter",$organization=null) |
|
| 227 | + public function thereIsAUserIdentifiedBy($email, $password, $role = User::ROLE_RECRUITER, $fullname = "Test Recruiter", $organization = null) |
|
| 228 | 228 | { |
| 229 | 229 | $repo = $this->getUserRepository(); |
| 230 | - if(!is_object($user=$repo->findByEmail($email))){ |
|
| 231 | - $user = $this->createUser($email,$password,$role,$fullname,$organization); |
|
| 230 | + if (!is_object($user = $repo->findByEmail($email))) { |
|
| 231 | + $user = $this->createUser($email, $password, $role, $fullname, $organization); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - if(!is_null($organization)){ |
|
| 235 | - $this->iHaveMainOrganization($user,$organization); |
|
| 234 | + if (!is_null($organization)) { |
|
| 235 | + $this->iHaveMainOrganization($user, $organization); |
|
| 236 | 236 | } |
| 237 | 237 | $this->addCreatedUser($user); |
| 238 | 238 | return $user; |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | * |
| 248 | 248 | * @return \Auth\Entity\UserInterface |
| 249 | 249 | */ |
| 250 | - public function createUser($email,$password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter") |
|
| 250 | + public function createUser($email, $password, $role = User::ROLE_RECRUITER, $fullname = "Test Recruiter") |
|
| 251 | 251 | { |
| 252 | 252 | /* @var Register $service */ |
| 253 | 253 | /* @var User $user */ |
@@ -258,10 +258,10 @@ discard block |
||
| 258 | 258 | $user->setRole($role); |
| 259 | 259 | $settings = $user->getSettings('Applications'); |
| 260 | 260 | |
| 261 | - $expFullName = explode(' ',$fullname); |
|
| 261 | + $expFullName = explode(' ', $fullname); |
|
| 262 | 262 | $info = $user->getInfo(); |
| 263 | 263 | $info->setFirstName(array_shift($expFullName)); |
| 264 | - $info->setLastName(count($expFullName)>0 ? implode(' ',$expFullName):''); |
|
| 264 | + $info->setLastName(count($expFullName) > 0 ? implode(' ', $expFullName) : ''); |
|
| 265 | 265 | $info->setEmail($email); |
| 266 | 266 | $info->setEmailVerified(true); |
| 267 | 267 | $repo->store($user); |
@@ -286,19 +286,19 @@ discard block |
||
| 286 | 286 | * @When I have :organization as my main organization |
| 287 | 287 | * @param $orgName |
| 288 | 288 | */ |
| 289 | - public function iHaveMainOrganization(UserInterface $user,$orgName) |
|
| 289 | + public function iHaveMainOrganization(UserInterface $user, $orgName) |
|
| 290 | 290 | { |
| 291 | 291 | /* @var $repoOrganization OrganizationRepository */ |
| 292 | 292 | $repoOrganization = $this->coreContext->getRepositories()->get('Organizations/Organization'); |
| 293 | - $organization=$repoOrganization->findByName($orgName); |
|
| 294 | - if(!$organization instanceof Organization){ |
|
| 293 | + $organization = $repoOrganization->findByName($orgName); |
|
| 294 | + if (!$organization instanceof Organization) { |
|
| 295 | 295 | $organization = new Organization(); |
| 296 | 296 | $organizationName = new OrganizationName($orgName); |
| 297 | 297 | $organization->setOrganizationName($organizationName); |
| 298 | 298 | $permissions = $organization->getPermissions(); |
| 299 | - $permissions->grant($user,Permissions::PERMISSION_ALL); |
|
| 300 | - }else { |
|
| 301 | - $organization->getPermissions()->grant($user,Permissions::PERMISSION_ALL); |
|
| 299 | + $permissions->grant($user, Permissions::PERMISSION_ALL); |
|
| 300 | + } else { |
|
| 301 | + $organization->getPermissions()->grant($user, Permissions::PERMISSION_ALL); |
|
| 302 | 302 | } |
| 303 | 303 | $organization->setUser($user); |
| 304 | 304 | $repoOrganization->store($organization); |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | public function iSpecifyTheUsernameAs($username) |
| 322 | 322 | { |
| 323 | - $this->minkContext->fillField('Login name',$username); |
|
| 323 | + $this->minkContext->fillField('Login name', $username); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | /** |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | public function iSpecifyThePasswordAs($password) |
| 330 | 330 | { |
| 331 | - $this->minkContext->fillField('Password',$password); |
|
| 331 | + $this->minkContext->fillField('Password', $password); |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | /** |
@@ -339,8 +339,8 @@ discard block |
||
| 339 | 339 | $repo = $this->getUserRepository(); |
| 340 | 340 | $user = $repo->findByLogin($username); |
| 341 | 341 | |
| 342 | - if(!$user instanceof User){ |
|
| 343 | - throw new \Exception(sprintf('There is no user with this login: "%s"',$username)); |
|
| 342 | + if (!$user instanceof User) { |
|
| 343 | + throw new \Exception(sprintf('There is no user with this login: "%s"', $username)); |
|
| 344 | 344 | } |
| 345 | 345 | $this->currentUser = $user; |
| 346 | 346 | $this->iWantToLogIn(); |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | public function iPressLogoutLink() |
| 364 | 364 | { |
| 365 | 365 | $url = $this->coreContext->generateUrl('/logout'); |
| 366 | - $url = str_replace('','',$url); |
|
| 366 | + $url = str_replace('', '', $url); |
|
| 367 | 367 | $this->minkContext->visit($url); |
| 368 | 368 | } |
| 369 | 369 | |
@@ -397,13 +397,13 @@ discard block |
||
| 397 | 397 | { |
| 398 | 398 | $repo = $this->getUserRepository(); |
| 399 | 399 | $data = $table->getRowsHash(); |
| 400 | - $email = isset($data['email']) ? $data['email']:'[email protected]'; |
|
| 401 | - $password = isset($data['password']) ? $data['password']:'test'; |
|
| 402 | - $fullname = isset($data['fullname']) ? $data['fullname']:'Test User'; |
|
| 403 | - $role = isset($data['role']) ? $data['role']:User::ROLE_RECRUITER; |
|
| 400 | + $email = isset($data['email']) ? $data['email'] : '[email protected]'; |
|
| 401 | + $password = isset($data['password']) ? $data['password'] : 'test'; |
|
| 402 | + $fullname = isset($data['fullname']) ? $data['fullname'] : 'Test User'; |
|
| 403 | + $role = isset($data['role']) ? $data['role'] : User::ROLE_RECRUITER; |
|
| 404 | 404 | |
| 405 | - if(!is_object($user=$repo->findByLogin($email))){ |
|
| 406 | - $user = $this->createUser($email,$password,$role,$fullname); |
|
| 405 | + if (!is_object($user = $repo->findByLogin($email))) { |
|
| 406 | + $user = $this->createUser($email, $password, $role, $fullname); |
|
| 407 | 407 | } |
| 408 | 408 | $this->currentUser = $user; |
| 409 | 409 | $this->addCreatedUser($user); |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | |
| 412 | 412 | private function addCreatedUser(UserInterface $user) |
| 413 | 413 | { |
| 414 | - if(!in_array($user,static::$users)){ |
|
| 414 | + if (!in_array($user, static::$users)) { |
|
| 415 | 415 | static::$users[] = $user; |
| 416 | 416 | } |
| 417 | 417 | } |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | public function __construct() |
| 33 | 33 | { |
| 34 | - static::$configFile = getcwd() . '/config/autoload/install.module.php'; |
|
| 35 | - static::$yawikGlobalConfig = getcwd() . '/config/autoload/yawik.config.global.php'; |
|
| 34 | + static::$configFile = getcwd().'/config/autoload/install.module.php'; |
|
| 35 | + static::$yawikGlobalConfig = getcwd().'/config/autoload/yawik.config.global.php'; |
|
| 36 | 36 | static::$yawikBackupConfig = str_replace('yawik.config.global.php', 'yawik.backup', static::$yawikGlobalConfig); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -42,18 +42,18 @@ discard block |
||
| 42 | 42 | public function iHaveInstallModuleActivated() |
| 43 | 43 | { |
| 44 | 44 | $target = static::$configFile; |
| 45 | - if(!file_exists($target)){ |
|
| 45 | + if (!file_exists($target)) { |
|
| 46 | 46 | $source = __DIR__.'/../resources/install.module.php'; |
| 47 | - copy($source,$target); |
|
| 48 | - chmod($target,0777); |
|
| 47 | + copy($source, $target); |
|
| 48 | + chmod($target, 0777); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | // backup existing file |
| 52 | 52 | $yawikBackupConfig = static::$yawikBackupConfig; |
| 53 | 53 | $yawikGlobalConfig = static::$yawikGlobalConfig; |
| 54 | 54 | |
| 55 | - if(is_file($yawikGlobalConfig)){ |
|
| 56 | - rename($yawikGlobalConfig,$yawikBackupConfig); |
|
| 55 | + if (is_file($yawikGlobalConfig)) { |
|
| 56 | + rename($yawikGlobalConfig, $yawikBackupConfig); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | public function iGoToInstallPage() |
| 64 | 64 | { |
| 65 | 65 | $url = $this->generateUrl('/'); |
| 66 | - $url = str_replace('/en','',$url); |
|
| 66 | + $url = str_replace('/en', '', $url); |
|
| 67 | 67 | $this->visit($url); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | static public function restoreConfig() |
| 95 | 95 | { |
| 96 | - if(is_file($file = static::$configFile)){ |
|
| 96 | + if (is_file($file = static::$configFile)) { |
|
| 97 | 97 | unlink($file); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | $yawikBackupConfig = static::$yawikBackupConfig; |
| 102 | 102 | $yawikGlobalConfig = static::$yawikGlobalConfig; |
| 103 | 103 | |
| 104 | - if(is_file($yawikBackupConfig)){ |
|
| 105 | - rename($yawikBackupConfig,$yawikGlobalConfig); |
|
| 104 | + if (is_file($yawikBackupConfig)) { |
|
| 105 | + rename($yawikBackupConfig, $yawikGlobalConfig); |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
@@ -113,6 +113,6 @@ discard block |
||
| 113 | 113 | { |
| 114 | 114 | $config = $this->getService('config'); |
| 115 | 115 | $connection = $config['doctrine']['connection']['odm_default']['connectionString']; |
| 116 | - $this->minkContext->fillField('db_conn',$connection); |
|
| 116 | + $this->minkContext->fillField('db_conn', $connection); |
|
| 117 | 117 | } |
| 118 | 118 | } |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | $repo = static::$jobRepo; |
| 59 | 59 | $results = $repo->findBy(['user' => $user]); |
| 60 | - foreach($results as $result){ |
|
| 61 | - $repo->remove($result,true); |
|
| 60 | + foreach ($results as $result) { |
|
| 61 | + $repo->remove($result, true); |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | public function beforeScenario(BeforeScenarioScope $scope) |
| 71 | 71 | { |
| 72 | 72 | $this->select2Context = $scope->getEnvironment()->getContext(Select2Context::class); |
| 73 | - if(is_null(static::$jobRepo)){ |
|
| 73 | + if (is_null(static::$jobRepo)) { |
|
| 74 | 74 | $this->gatherContexts($scope); |
| 75 | 75 | static::$jobRepo = $this->getJobRepository(); |
| 76 | 76 | } |
@@ -108,8 +108,8 @@ discard block |
||
| 108 | 108 | public function iGoToEditJobWithTitle($jobTitle) |
| 109 | 109 | { |
| 110 | 110 | $job = $this->getJobRepository()->findOneBy(['title' => $jobTitle]); |
| 111 | - if(!$job instanceof Job){ |
|
| 112 | - throw new \Exception(sprintf('Job with title "%s" is not found',$jobTitle)); |
|
| 111 | + if (!$job instanceof Job) { |
|
| 112 | + throw new \Exception(sprintf('Job with title "%s" is not found', $jobTitle)); |
|
| 113 | 113 | } |
| 114 | 114 | $this->currentJob = $job; |
| 115 | 115 | $url = '/jobs/edit?id='.$job->getId(); |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | $user = $this->getCurrentUser(); |
| 136 | 136 | $jobRepository = $this->getJobRepository(); |
| 137 | 137 | $results = $jobRepository->getUserJobs($user->getId()); |
| 138 | - foreach($results as $job){ |
|
| 139 | - $jobRepository->remove($job,true); |
|
| 138 | + foreach ($results as $job) { |
|
| 139 | + $jobRepository->remove($job, true); |
|
| 140 | 140 | } |
| 141 | 141 | $this->currentJob = null; |
| 142 | 142 | } |
@@ -145,16 +145,16 @@ discard block |
||
| 145 | 145 | * @When I fill job location search with :search and choose :choice |
| 146 | 146 | * |
| 147 | 147 | */ |
| 148 | - public function iFillJobLocationAndChoose($search,$choice) |
|
| 148 | + public function iFillJobLocationAndChoose($search, $choice) |
|
| 149 | 149 | { |
| 150 | 150 | $select2 = $this->select2Context; |
| 151 | - $select2->iFillInSelect2FieldWith('jobBase[geoLocation]',$search,$choice); |
|
| 151 | + $select2->iFillInSelect2FieldWith('jobBase[geoLocation]', $search, $choice); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
| 155 | 155 | * @When I choose :value from :field |
| 156 | 156 | */ |
| 157 | - public function iJobClassificationSelect($value,$field) |
|
| 157 | + public function iJobClassificationSelect($value, $field) |
|
| 158 | 158 | { |
| 159 | 159 | $field = Inflector::camelize($field); |
| 160 | 160 | |
@@ -170,18 +170,18 @@ discard block |
||
| 170 | 170 | 'employmentTypes' => "select#classifications-employmentTypes", |
| 171 | 171 | ]; |
| 172 | 172 | |
| 173 | - if(!isset($mapSelect2[$field])){ |
|
| 173 | + if (!isset($mapSelect2[$field])) { |
|
| 174 | 174 | throw new \Exception('Undefined field selection value "'.$field.'"'); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | $multipleField = $mapMultiple[$field]; |
| 178 | 178 | $page = $this->minkContext->getSession()->getPage(); |
| 179 | - $element = $page->find('css',$mapMultiple[$field]); |
|
| 180 | - if(!is_null($element) && $element->getAttribute('multiple')=='multiple'){ |
|
| 181 | - $this->minkContext->selectOption($value,$multipleField); |
|
| 182 | - }else{ |
|
| 179 | + $element = $page->find('css', $mapMultiple[$field]); |
|
| 180 | + if (!is_null($element) && $element->getAttribute('multiple') == 'multiple') { |
|
| 181 | + $this->minkContext->selectOption($value, $multipleField); |
|
| 182 | + } else { |
|
| 183 | 183 | $locator = $mapSelect2[$field]; |
| 184 | - $this->select2Context->iFillInSelect2Field($locator,$value); |
|
| 184 | + $this->select2Context->iFillInSelect2Field($locator, $value); |
|
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | |
@@ -205,62 +205,62 @@ discard block |
||
| 205 | 205 | * @When I have a :status job with the following: |
| 206 | 206 | * @param TableNode $fields |
| 207 | 207 | */ |
| 208 | - public function iHaveAJobWithTheFollowing($status,TableNode $fields) |
|
| 208 | + public function iHaveAJobWithTheFollowing($status, TableNode $fields) |
|
| 209 | 209 | { |
| 210 | 210 | $normalizedField = [ |
| 211 | 211 | 'template' => 'modern', |
| 212 | 212 | ]; |
| 213 | - foreach($fields->getRowsHash() as $field => $value){ |
|
| 213 | + foreach ($fields->getRowsHash() as $field => $value) { |
|
| 214 | 214 | $field = Inflector::camelize($field); |
| 215 | - if($field == 'professions' || $field == 'industries'){ |
|
| 216 | - $value = explode(',',$value); |
|
| 215 | + if ($field == 'professions' || $field == 'industries') { |
|
| 216 | + $value = explode(',', $value); |
|
| 217 | 217 | } |
| 218 | 218 | $normalizedField[$field] = $value; |
| 219 | 219 | } |
| 220 | 220 | $jobRepo = $this->getJobRepository(); |
| 221 | 221 | $job = $jobRepo->findOneBy(['title' => $normalizedField['title']]); |
| 222 | - if(!$job instanceof Job){ |
|
| 222 | + if (!$job instanceof Job) { |
|
| 223 | 223 | $job = new Job(); |
| 224 | 224 | $job->setTitle($normalizedField['title']); |
| 225 | 225 | } |
| 226 | - if(isset($normalizedField['user'])){ |
|
| 226 | + if (isset($normalizedField['user'])) { |
|
| 227 | 227 | /* @var $userRepo UserRepository */ |
| 228 | 228 | $userRepo = $this->getRepository('Auth\Entity\User'); |
| 229 | 229 | $user = $userRepo->findOneBy(['login' => $normalizedField['user']]); |
| 230 | - if($user instanceof User){ |
|
| 230 | + if ($user instanceof User) { |
|
| 231 | 231 | $job->setUser($user); |
| 232 | 232 | $job->setOrganization($user->getOrganization()->getOrganization()); |
| 233 | - }else{ |
|
| 233 | + } else { |
|
| 234 | 234 | throw new \Exception('There is no user with this login:"'.$normalizedField['user'.'"']); |
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - if($status == 'draft'){ |
|
| 238 | + if ($status == 'draft') { |
|
| 239 | 239 | $job->setIsDraft(true); |
| 240 | - }elseif($status == 'published'){ |
|
| 240 | + }elseif ($status == 'published') { |
|
| 241 | 241 | $job->setIsDraft(false); |
| 242 | 242 | $job->setDatePublishStart(new \DateTime()); |
| 243 | 243 | } |
| 244 | 244 | $job->setStatus(Status::ACTIVE); |
| 245 | 245 | |
| 246 | - if(isset($normalizedField['location'])){ |
|
| 247 | - $this->setLocation($job,$normalizedField['location']); |
|
| 246 | + if (isset($normalizedField['location'])) { |
|
| 247 | + $this->setLocation($job, $normalizedField['location']); |
|
| 248 | 248 | } |
| 249 | - if(isset($normalizedField['companyName'])){ |
|
| 249 | + if (isset($normalizedField['companyName'])) { |
|
| 250 | 250 | //$job->setCompany($normalizedField['companyName']); |
| 251 | 251 | } |
| 252 | - if(isset($normalizedField['professions'])){ |
|
| 253 | - $this->addProfessions($job,$normalizedField['professions']); |
|
| 252 | + if (isset($normalizedField['professions'])) { |
|
| 253 | + $this->addProfessions($job, $normalizedField['professions']); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - if(isset($normalizedField['industries'])){ |
|
| 257 | - $this->addIndustries($job,$normalizedField['industries']); |
|
| 256 | + if (isset($normalizedField['industries'])) { |
|
| 257 | + $this->addIndustries($job, $normalizedField['industries']); |
|
| 258 | 258 | } |
| 259 | - if(isset($normalizedField['employmentTypes'])){ |
|
| 259 | + if (isset($normalizedField['employmentTypes'])) { |
|
| 260 | 260 | $types = $this->getCategories([$normalizedField['employmentTypes']]); |
| 261 | 261 | $type = array_shift($types); |
| 262 | 262 | $values = $job->getClassifications()->getEmploymentTypes()->getValues(); |
| 263 | - if(!is_array($values) || !in_array($type,$values)){ |
|
| 263 | + if (!is_array($values) || !in_array($type, $values)) { |
|
| 264 | 264 | $job->getClassifications()->getEmploymentTypes()->getItems()->add($type); |
| 265 | 265 | } |
| 266 | 266 | } |
@@ -279,18 +279,18 @@ discard block |
||
| 279 | 279 | $location->fromString($serialized); |
| 280 | 280 | |
| 281 | 281 | $locations = $job->getLocations(); |
| 282 | - if(count($locations)){ |
|
| 282 | + if (count($locations)) { |
|
| 283 | 283 | $locations->clear(); |
| 284 | 284 | } |
| 285 | 285 | $job->getLocations()->add($location); |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - private function addProfessions(Job &$job,$terms) |
|
| 288 | + private function addProfessions(Job &$job, $terms) |
|
| 289 | 289 | { |
| 290 | 290 | $professions = $this->getCategories($terms); |
| 291 | - foreach($professions as $profession){ |
|
| 291 | + foreach ($professions as $profession) { |
|
| 292 | 292 | $values = $job->getClassifications()->getProfessions()->getValues(); |
| 293 | - if(!is_array($values) || !in_array($profession,$values)){ |
|
| 293 | + if (!is_array($values) || !in_array($profession, $values)) { |
|
| 294 | 294 | $job->getClassifications()->getProfessions()->getItems()->add($profession); |
| 295 | 295 | } |
| 296 | 296 | } |
@@ -299,9 +299,9 @@ discard block |
||
| 299 | 299 | private function addIndustries(Job &$job, $terms) |
| 300 | 300 | { |
| 301 | 301 | $industries = $this->getCategories($terms); |
| 302 | - foreach($industries as $industry){ |
|
| 302 | + foreach ($industries as $industry) { |
|
| 303 | 303 | $values = $job->getClassifications()->getIndustries()->getValues(); |
| 304 | - if(!is_array($values) || !in_array($industry,$values)){ |
|
| 304 | + if (!is_array($values) || !in_array($industry, $values)) { |
|
| 305 | 305 | $job->getClassifications()->getIndustries()->getItems()->add($industry); |
| 306 | 306 | } |
| 307 | 307 | } |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | |
| 337 | 337 | $job = $repo->findDraft($user); |
| 338 | 338 | |
| 339 | - if(is_null($job)){ |
|
| 339 | + if (is_null($job)) { |
|
| 340 | 340 | $job = new Job(); |
| 341 | 341 | $job |
| 342 | 342 | ->setUser($user) |
@@ -11,23 +11,23 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | date_default_timezone_set('Europe/Berlin'); |
| 13 | 13 | |
| 14 | -if(!version_compare(PHP_VERSION, '5.6.0', 'ge')){ |
|
| 15 | - echo sprintf('<p>Sorry, YAWIK requires at least PHP 5.6.0 to run, but this server currently provides PHP %s</p>',PHP_VERSION); |
|
| 14 | +if (!version_compare(PHP_VERSION, '5.6.0', 'ge')) { |
|
| 15 | + echo sprintf('<p>Sorry, YAWIK requires at least PHP 5.6.0 to run, but this server currently provides PHP %s</p>', PHP_VERSION); |
|
| 16 | 16 | echo '<p>Please ask your servers\' administrator to install the proper PHP version.</p>'; |
| 17 | 17 | exit; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | if (php_sapi_name() == 'cli-server') { |
| 21 | 21 | $parseUrl = parse_url(substr($_SERVER["REQUEST_URI"], 1)); |
| 22 | - $route = isset($parseUrl['path']) ? $parseUrl['path']:null; |
|
| 23 | - if (is_file(__DIR__ . '/' . $route)) { |
|
| 24 | - if(substr($route, -4) == ".php"){ |
|
| 25 | - require __DIR__ . '/' . $route; // Include requested script files |
|
| 22 | + $route = isset($parseUrl['path']) ? $parseUrl['path'] : null; |
|
| 23 | + if (is_file(__DIR__.'/'.$route)) { |
|
| 24 | + if (substr($route, -4) == ".php") { |
|
| 25 | + require __DIR__.'/'.$route; // Include requested script files |
|
| 26 | 26 | exit; |
| 27 | 27 | } |
| 28 | - return false; // Serve file as is |
|
| 28 | + return false; // Serve file as is |
|
| 29 | 29 | } else { // Fallback to index.php |
| 30 | - $_GET["q"] = $route; // Try to emulate the behaviour of a .htaccess here. |
|
| 30 | + $_GET["q"] = $route; // Try to emulate the behaviour of a .htaccess here. |
|
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | } else { |
| 48 | 48 | echo '<p>Could not initialize autoloading. This happens, if the dependencies are not installed yet.</p>'; |
| 49 | 49 | echo '<p>Please try to install the dependencies via: </p>'; |
| 50 | - echo '<code>cd '. realpath('.') .'<br>./install.sh</code>'; |
|
| 51 | - echo '<p>exit at ' . __FILE__ . ' in line ' . __LINE__ .'</p>'; |
|
| 50 | + echo '<code>cd '.realpath('.').'<br>./install.sh</code>'; |
|
| 51 | + echo '<p>exit at '.__FILE__.' in line '.__LINE__.'</p>'; |
|
| 52 | 52 | exit; |
| 53 | 53 | } |
| 54 | 54 | |