Completed
Push — develop ( a5396a...45a0ea )
by Mathias
05:23
created
module/Organizations/src/Organizations/Entity/Organization.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -47,17 +47,17 @@  discard block
 block discarded – undo
47 47
     /**
48 48
      * Always enabled even if there are no active jobs
49 49
      */
50
-    const PROFILE_ALWAYS_ENABLE     = 'always';
50
+    const PROFILE_ALWAYS_ENABLE = 'always';
51 51
 
52 52
     /**
53 53
      * Hide if there are no jobs available
54 54
      */
55
-    const PROFILE_ACTIVE_JOBS       = 'active-jobs';
55
+    const PROFILE_ACTIVE_JOBS = 'active-jobs';
56 56
 
57 57
     /**
58 58
      * Always disabled profile
59 59
      */
60
-    const PROFILE_DISABLED          = 'disabled';
60
+    const PROFILE_DISABLED = 'disabled';
61 61
 
62 62
     /**
63 63
      * Event name of post construct event.
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      */
286 286
     public function getParent($returnSelf = false)
287 287
     {
288
-        return $this->parent ? : ($returnSelf ? $this : null);
288
+        return $this->parent ?: ($returnSelf ? $this : null);
289 289
     }
290 290
 
291 291
     /**
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
      */
517 517
     public function getPermissionsResourceId()
518 518
     {
519
-        return 'organization:' . $this->getId();
519
+        return 'organization:'.$this->getId();
520 520
     }
521 521
 
522 522
     /**
Please login to merge, or discard this patch.
Organizations/src/Organizations/Form/OrganizationsProfileFieldset.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
     public function getHydrator()
25 25
     {
26 26
         if (!$this->hydrator) {
27
-            $hydrator           = new EntityHydrator();
27
+            $hydrator = new EntityHydrator();
28 28
             $this->setHydrator($hydrator);
29 29
         }
30 30
         return $this->hydrator;
Please login to merge, or discard this patch.
module/Behat/src/UserContext.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     protected $currentUser;
65 65
 	
66
-	public function __construct($parameters=[])
66
+	public function __construct($parameters = [])
67 67
 	{
68 68
 		$defaultLoginInfo = [
69 69
 			'facebook' => [
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 				'session_password-login' => getenv('LINKEDIN_USER_PASSWORD')
76 76
 			],
77 77
 		];
78
-		$socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info']:[];
79
-		$this->socialLoginInfo = array_merge($defaultLoginInfo,$socialLoginConfig);
78
+		$socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info'] : [];
79
+		$this->socialLoginInfo = array_merge($defaultLoginInfo, $socialLoginConfig);
80 80
 	}
81 81
 
82 82
     /**
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             'Auth\Entity\UserImage',
99 99
             'Organizations\Entity\OrganizationName',
100 100
         ];
101
-        foreach($documents as $document){
101
+        foreach ($documents as $document) {
102 102
             $dm->createQueryBuilder($document)
103 103
                 ->remove()
104 104
                 ->getQuery()
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	{
127 127
 		$provider = strtolower($provider);
128 128
 		$mink = $this->minkContext;
129
-		foreach($this->socialLoginInfo[$provider] as $field=>$value){
130
-			$mink->fillField($field,$value);
129
+		foreach ($this->socialLoginInfo[$provider] as $field=>$value) {
130
+			$mink->fillField($field, $value);
131 131
 		}
132 132
 	}
133 133
 	
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
 	 * @Given I am logged in as a recruiter
136 136
 	 * @Given I am logged in as a recruiter with :organization as organization
137 137
 	 */
138
-	public function iAmLoggedInAsARecruiter($organization=null)
138
+	public function iAmLoggedInAsARecruiter($organization = null)
139 139
 	{
140 140
 		$user = $this->thereIsAUserIdentifiedBy(
141 141
 			'[email protected]',
142
-			'test',User::ROLE_RECRUITER,
142
+			'test', User::ROLE_RECRUITER,
143 143
 			'Test Recruiter',
144 144
 			$organization
145 145
 		);
146
-		$this->startLogin($user,'test');
147
-		if(!is_null($organization)){
148
-            $this->iHaveMainOrganization($user,$organization);
146
+		$this->startLogin($user, 'test');
147
+		if (!is_null($organization)) {
148
+            $this->iHaveMainOrganization($user, $organization);
149 149
         }
150 150
 	}
151 151
 	
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 	public function iDonTHaveUser($login)
157 157
 	{
158 158
 		$repo = $this->getUserRepository();
159
-		$user=$repo->findByLogin($login);
160
-		if($user instanceof UserInterface){
161
-			$repo->remove($user,true);
159
+		$user = $repo->findByLogin($login);
160
+		if ($user instanceof UserInterface) {
161
+			$repo->remove($user, true);
162 162
 		}
163 163
 	}
164 164
 	
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 * @param $role
168 168
 	 * @param TableNode $fields
169 169
 	 */
170
-	public function iHaveUserWithTheFollowing($role,TableNode $fields)
170
+	public function iHaveUserWithTheFollowing($role, TableNode $fields)
171 171
 	{
172 172
 		$normalizedFields = [
173 173
 			'login' => '[email protected]',
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 			'password' => 'test',
177 177
 			'organization' => 'Cross Solution'
178 178
 		];
179
-		foreach($fields->getRowsHash() as $field=>$value){
179
+		foreach ($fields->getRowsHash() as $field=>$value) {
180 180
 			$field = Inflector::camelize($field);
181 181
 			$normalizedFields[$field] = $value;
182 182
 		}
@@ -196,14 +196,14 @@  discard block
 block discarded – undo
196 196
 	 */
197 197
 	public function iAmLoggedInAsAnAdmin()
198 198
 	{
199
-		$user = $this->thereIsAUserIdentifiedBy('[email protected]','test',User::ROLE_ADMIN);
200
-		$this->startLogin($user,'test');
199
+		$user = $this->thereIsAUserIdentifiedBy('[email protected]', 'test', User::ROLE_ADMIN);
200
+		$this->startLogin($user, 'test');
201 201
 	}
202 202
 	
203 203
 	private function startLogin(UserInterface $user, $password)
204 204
 	{
205 205
 		$currentUser = $this->currentUser;
206
-		if(!is_object($currentUser) || $user->getId()!=$currentUser->getId()){
206
+		if (!is_object($currentUser) || $user->getId() != $currentUser->getId()) {
207 207
 			$this->iWantToLogIn();
208 208
 			$this->iSpecifyTheUsernameAs($user->getLogin());
209 209
 			$this->iSpecifyThePasswordAs($password);
@@ -223,15 +223,15 @@  discard block
 block discarded – undo
223 223
 	/**
224 224
 	 * @Given there is a user :email identified by :password
225 225
 	 */
226
-	public function thereIsAUserIdentifiedBy($email, $password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter",$organization=null)
226
+	public function thereIsAUserIdentifiedBy($email, $password, $role = User::ROLE_RECRUITER, $fullname = "Test Recruiter", $organization = null)
227 227
 	{
228 228
 		$repo = $this->getUserRepository();
229
-		if(!is_object($user=$repo->findByEmail($email))){
230
-			$user = $this->createUser($email,$password,$role,$fullname,$organization);
229
+		if (!is_object($user = $repo->findByEmail($email))) {
230
+			$user = $this->createUser($email, $password, $role, $fullname, $organization);
231 231
 		}
232 232
 		
233
-		if(!is_null($organization)){
234
-			$this->iHaveMainOrganization($user,$organization);
233
+		if (!is_null($organization)) {
234
+			$this->iHaveMainOrganization($user, $organization);
235 235
 		}
236 236
 		$this->addCreatedUser($user);
237 237
 		$repo->getDocumentManager()->refresh($user);
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,20 +286,20 @@  discard block
 block discarded – undo
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 293
 		$result = $repoOrganization->findByName($orgName);
294
-		$organization = count($result) > 0 ? $result[0]:null;
295
-		if(!$organization instanceof Organization){
294
+		$organization = count($result) > 0 ? $result[0] : null;
295
+		if (!$organization instanceof Organization) {
296 296
 			$organization = new Organization();
297 297
 			$organizationName = new OrganizationName($orgName);
298 298
 			$organization->setOrganizationName($organizationName);
299 299
 		}
300 300
         $organization->setProfileSetting(Organization::PROFILE_ALWAYS_ENABLE);
301 301
         $permissions = $organization->getPermissions();
302
-        $permissions->grant($user,Permissions::PERMISSION_ALL);
302
+        $permissions->grant($user, Permissions::PERMISSION_ALL);
303 303
 
304 304
         $organization->setUser($user);
305 305
         $repoOrganization->store($organization);
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	 */
333 333
 	public function iSpecifyTheUsernameAs($username)
334 334
 	{
335
-		$this->minkContext->fillField('Login name',$username);
335
+		$this->minkContext->fillField('Login name', $username);
336 336
 	}
337 337
 	
338 338
 	/**
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	 */
341 341
 	public function iSpecifyThePasswordAs($password)
342 342
 	{
343
-		$this->minkContext->fillField('Password',$password);
343
+		$this->minkContext->fillField('Password', $password);
344 344
 	}
345 345
 	
346 346
 	/**
@@ -351,8 +351,8 @@  discard block
 block discarded – undo
351 351
 		$repo = $this->getUserRepository();
352 352
 		$user = $repo->findByLogin($username);
353 353
 		
354
-		if(!$user instanceof User){
355
-			throw new \Exception(sprintf('There is no user with this login: "%s"',$username));
354
+		if (!$user instanceof User) {
355
+			throw new \Exception(sprintf('There is no user with this login: "%s"', $username));
356 356
 		}
357 357
 		$this->iWantToLogIn();
358 358
 		$this->iSpecifyTheUsernameAs($username);
@@ -408,13 +408,13 @@  discard block
 block discarded – undo
408 408
 	{
409 409
 		$repo = $this->getUserRepository();
410 410
 		$data = $table->getRowsHash();
411
-		$email = isset($data['email']) ? $data['email']:'[email protected]';
412
-		$password = isset($data['password']) ? $data['password']:'test';
413
-		$fullname = isset($data['fullname']) ? $data['fullname']:'Test User';
414
-		$role = isset($data['role']) ? $data['role']:User::ROLE_RECRUITER;
411
+		$email = isset($data['email']) ? $data['email'] : '[email protected]';
412
+		$password = isset($data['password']) ? $data['password'] : 'test';
413
+		$fullname = isset($data['fullname']) ? $data['fullname'] : 'Test User';
414
+		$role = isset($data['role']) ? $data['role'] : User::ROLE_RECRUITER;
415 415
 		
416
-		if(!is_object($user=$repo->findByLogin($email))){
417
-			$user = $this->createUser($email,$password,$role,$fullname);
416
+		if (!is_object($user = $repo->findByLogin($email))) {
417
+			$user = $this->createUser($email, $password, $role, $fullname);
418 418
 		}
419 419
 		$this->currentUser = $user;
420 420
 		$this->addCreatedUser($user);
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 	
423 423
 	private function addCreatedUser(UserInterface $user)
424 424
 	{
425
-		if(!in_array($user,static::$users)){
425
+		if (!in_array($user, static::$users)) {
426 426
 			static::$users[] = $user;
427 427
 		}
428 428
 	}
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
      */
443 443
 	public function getCurrentUser()
444 444
     {
445
-        if(!$this->currentUser instanceof User){
445
+        if (!$this->currentUser instanceof User) {
446 446
             throw new FailedExpectationException('Need to login first before use this step');
447 447
         }
448 448
         return $this->currentUser;
Please login to merge, or discard this patch.
module/Behat/src/CommonContextTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,16 +51,16 @@
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
module/Behat/src/CoreContext.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function setupContexts(BeforeScenarioScope $scope)
37 37
 	{
38
-		if(false === static::$jobCategoryChecked){
38
+		if (false === static::$jobCategoryChecked) {
39 39
 			/* @var Categories $catRepo */
40 40
 			$catRepo = $this->getRepositories()->get('Jobs/Category');
41 41
 			$all = $catRepo->findAll();
42
-			if(count($all) <= 1){
42
+			if (count($all) <= 1) {
43 43
 				$catRepo->createDefaultCategory('professions');
44 44
 				$catRepo->createDefaultCategory('industries');
45 45
 				$catRepo->createDefaultCategory('employmentTypes');
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function getApplication()
55 55
 	{
56
-		if(!is_object(static::$application)){
56
+		if (!is_object(static::$application)) {
57 57
 			$configFile = realpath(__DIR__.'/../../../config/config.php');
58 58
 			$config = include($configFile);
59 59
 			static::$application = Application::init($config);
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	public function iSubmitTheFormWithId($arg)
138 138
 	{
139 139
 		$node = $this->minkContext->getSession()->getPage()->find('css', $arg);
140
-		if($node) {
140
+		if ($node) {
141 141
 			$this->minkContext->getSession()->executeScript("jQuery('$arg').submit();");
142 142
 		} else {
143 143
 			throw new \Exception('Element not found');
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	public function iSetMainWindowName()
162 162
 	{
163 163
 		$window_name = 'main_window';
164
-		$script = 'window.name = "' . $window_name . '"';
164
+		$script = 'window.name = "'.$window_name.'"';
165 165
 		$this->getSession()->executeScript($script);
166 166
 	}
167 167
 	
@@ -220,14 +220,14 @@  discard block
 block discarded – undo
220 220
 				break;
221 221
 			
222 222
 			default:
223
-				throw new \Exception(__METHOD__ . ' Couldn\'t find selector: ' . $selector . ' - Allowed selectors: #id, .className, //xpath');
223
+				throw new \Exception(__METHOD__.' Couldn\'t find selector: '.$selector.' - Allowed selectors: #id, .className, //xpath');
224 224
 				break;
225 225
 		}
226 226
 		
227 227
 		try {
228 228
 			$this->getSession()->executeScript($function);
229 229
 		} catch (\Exception $e) {
230
-			throw new \Exception(__METHOD__ . ' failed'. ' Message: for this locator:"'.$selector.'"');
230
+			throw new \Exception(__METHOD__.' failed'.' Message: for this locator:"'.$selector.'"');
231 231
 		}
232 232
 	}
233 233
 	
@@ -247,10 +247,10 @@  discard block
 block discarded – undo
247 247
 	 *
248 248
 	 * @return \Behat\Mink\Element\NodeElement|mixed|null
249 249
 	 */
250
-	public function getElement($locator,$selector='css')
250
+	public function getElement($locator, $selector = 'css')
251 251
 	{
252 252
 		$page = $this->minkContext->getSession()->getPage();
253
-		$element = $page->find('css',$locator);
253
+		$element = $page->find('css', $locator);
254 254
 		return $element;
255 255
 	}
256 256
 	
@@ -282,12 +282,12 @@  discard block
 block discarded – undo
282 282
 		$session = $this->getSession();
283 283
 		$element = $session->getPage()->find(
284 284
 			'xpath',
285
-			$session->getSelectorsHandler()->selectorToXpath('xpath', '*//*[text()="'. $text .'"]')
285
+			$session->getSelectorsHandler()->selectorToXpath('xpath', '*//*[text()="'.$text.'"]')
286 286
 		);
287
-		if(null === $element){
287
+		if (null === $element) {
288 288
 			$element = $session->getPage()->find(
289 289
 				'named',
290
-				array('id',$text)
290
+				array('id', $text)
291 291
 			);
292 292
 		}
293 293
 		if (null === $element) {
Please login to merge, or discard this patch.
module/Behat/src/SettingsContext.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
module/Behat/src/ApplicationContext.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
module/Core/src/Core/Factory/Controller/LazyControllerFactory.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -36,47 +36,47 @@  discard block
 block discarded – undo
36 36
         RepositoryService::class => 'repositories',
37 37
 	];
38 38
 	
39
-	public function canCreate( ContainerInterface $container, $requestedName )
39
+	public function canCreate(ContainerInterface $container, $requestedName)
40 40
 	{
41
-		return strstr( $requestedName,'\Controller') !== false;
41
+		return strstr($requestedName, '\Controller') !== false;
42 42
 	}
43 43
 
44
-	public function __invoke( ContainerInterface $container, $requestedName, array $options = null )
44
+	public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
45 45
 	{
46 46
         $className = $this->getClassName($requestedName);
47 47
 		$class = new \ReflectionClass($className);
48 48
 
49
-		if( $constructor = $class->getConstructor() )
49
+		if ($constructor = $class->getConstructor())
50 50
 		{
51
-			if( $params = $constructor->getParameters() )
51
+			if ($params = $constructor->getParameters())
52 52
 			{
53 53
 				$constructorArgs = [];
54
-				foreach( $params as $p )
54
+				foreach ($params as $p)
55 55
 				{
56 56
 					$serviceName = '';
57
-					if( $p->getClass() ) {
57
+					if ($p->getClass()) {
58 58
 						$serviceName = $p->getClass()->getName();
59 59
 						if (array_key_exists($serviceName, $this->aliases)) {
60 60
 							$serviceName = $this->aliases[$serviceName];
61 61
 						}
62 62
 					}
63
-					else{
64
-						if( $p->getName() == 'config' ){
63
+					else {
64
+						if ($p->getName() == 'config') {
65 65
                             $serviceName = 'config';
66 66
                         }
67 67
 					}
68 68
 
69
-					if(!$container->has($serviceName)){
69
+					if (!$container->has($serviceName)) {
70 70
 					    throw new ServiceNotCreatedException(sprintf(
71 71
 					        'Can\'t create constructor argument "%s" for service "%s"',
72
-                            $p->getName(),$requestedName
72
+                            $p->getName(), $requestedName
73 73
                         ));
74 74
                     }
75 75
                     try {
76 76
                         $constructorArgs[] = $container->get($serviceName);
77 77
                     }
78 78
                     catch (\Exception $x) {
79
-                        echo __CLASS__ . " couldn't create an instance of {$p->getName()} to satisfy the constructor for $requestedName.";
79
+                        echo __CLASS__." couldn't create an instance of {$p->getName()} to satisfy the constructor for $requestedName.";
80 80
                         exit;
81 81
                     }
82 82
 				}
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
      */
96 96
     private function getClassName($requestedName)
97 97
     {
98
-        $exp = explode('/',$requestedName);
98
+        $exp = explode('/', $requestedName);
99 99
 
100
-        $className = array_shift($exp).'\\Controller\\'.implode('\\',$exp).'Controller';
101
-        if(!class_exists($className)){
100
+        $className = array_shift($exp).'\\Controller\\'.implode('\\', $exp).'Controller';
101
+        if (!class_exists($className)) {
102 102
             throw new ServiceNotCreatedException(
103 103
                 sprintf(
104 104
                     'Can\'t find correct controller class for "%s"',
Please login to merge, or discard this patch.
module/Behat/src/JobContext.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)
Please login to merge, or discard this patch.