@@ -227,11 +227,11 @@ discard block |
||
227 | 227 | protected function save() |
228 | 228 | { |
229 | 229 | $formEvents = $this->jobFormEvents; |
230 | - $user = $this->auth->getUser(); |
|
230 | + $user = $this->auth->getUser(); |
|
231 | 231 | if (empty($user->getInfo()->getEmail())) { |
232 | 232 | return $this->getErrorViewModel('no-parent', array('cause' => 'noEmail')); |
233 | 233 | } |
234 | - $userOrg = $user->getOrganization(); |
|
234 | + $userOrg = $user->getOrganization(); |
|
235 | 235 | if (!$userOrg->hasAssociation() || $userOrg->getOrganization()->isDraft()) { |
236 | 236 | return $this->getErrorViewModel('no-parent', array('cause' => 'noCompany')); |
237 | 237 | } |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | } |
262 | 262 | |
263 | 263 | |
264 | - $viewModel = null; |
|
264 | + $viewModel = null; |
|
265 | 265 | $this->acl($jobEntity, 'edit'); |
266 | 266 | if ($status = $params->fromQuery('status')) { |
267 | 267 | $this->changeStatus($jobEntity, $status); |
@@ -273,11 +273,11 @@ discard block |
||
273 | 273 | $instanceForm = null; |
274 | 274 | $formErrorMessages = array(); |
275 | 275 | |
276 | - if (isset($formIdentifier) && $request->isPost()) { |
|
276 | + if (isset($formIdentifier) && $request->isPost()) { |
|
277 | 277 | // at this point the form get instantiated and immediately accumulated |
278 | 278 | $instanceForm = $form->getForm($formIdentifier); |
279 | 279 | if (!isset($instanceForm)) { |
280 | - throw new \RuntimeException('No form found for "' . $formIdentifier . '"'); |
|
280 | + throw new \RuntimeException('No form found for "'.$formIdentifier.'"'); |
|
281 | 281 | } |
282 | 282 | // the id may be part of the postData, but it never should be altered |
283 | 283 | $postData = $request->getPost(); |
@@ -331,20 +331,20 @@ discard block |
||
331 | 331 | $jobValid = false; |
332 | 332 | $errorMessage[] = $this->translator->translate('Accept the Terms'); |
333 | 333 | } |
334 | - $result = $formEvents->trigger('ValidateJob', $this, [ 'form' => $form ]); |
|
334 | + $result = $formEvents->trigger('ValidateJob', $this, ['form' => $form]); |
|
335 | 335 | foreach ($result as $messages) { |
336 | 336 | if (!$messages) { |
337 | 337 | continue; |
338 | 338 | } |
339 | 339 | if (!is_array($messages)) { |
340 | - $messages = [ $messages ]; |
|
340 | + $messages = [$messages]; |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | $errorMessage = array_merge($errorMessage, $messages); |
344 | 344 | $jobValid = false; |
345 | 345 | } |
346 | 346 | |
347 | - $errorMessage = '<br />' . implode('<br />', $errorMessage); |
|
347 | + $errorMessage = '<br />'.implode('<br />', $errorMessage); |
|
348 | 348 | if ($isAjax) { |
349 | 349 | if ($instanceForm instanceof SummaryForm) { |
350 | 350 | $instanceForm->setRenderMode(SummaryForm::RENDER_SUMMARY); |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | } else { |
353 | 353 | $viewHelper = 'form'; |
354 | 354 | } |
355 | - $viewHelperManager = $this->viewHelper; |
|
355 | + $viewHelperManager = $this->viewHelper; |
|
356 | 356 | $content = $viewHelperManager->get($viewHelper)->__invoke($instanceForm); |
357 | 357 | $viewModel = new JsonModel( |
358 | 358 | array( |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | } |
377 | 377 | } |
378 | 378 | } else { |
379 | - $formEvents->trigger('DisableElements', $this, [ 'form' => $form, 'job'=>$jobEntity ]); |
|
379 | + $formEvents->trigger('DisableElements', $this, ['form' => $form, 'job'=>$jobEntity]); |
|
380 | 380 | // Job is deployed, some changes are now disabled |
381 | 381 | $form->enableAll(); |
382 | 382 | } |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | |
385 | 385 | $completionLink = $this->url()->fromRoute( |
386 | 386 | 'lang/jobs/completion', |
387 | - [ 'id' => $jobEntity->getId()] |
|
387 | + ['id' => $jobEntity->getId()] |
|
388 | 388 | ); |
389 | 389 | |
390 | 390 | $viewModel = $this->getViewModel($form); |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | protected function getFormular($job) |
451 | 451 | { |
452 | 452 | /* @var $forms \Zend\Form\FormElementManager\FormElementManagerV3Polyfill */ |
453 | - $forms = $this->formManager; |
|
453 | + $forms = $this->formManager; |
|
454 | 454 | /* @var $container \Jobs\Form\Job */ |
455 | 455 | |
456 | 456 | $container = $forms->get( |
@@ -555,11 +555,11 @@ discard block |
||
555 | 555 | // array with differences between the last snapshot and the actual entity |
556 | 556 | // is remains Null if there is no snapshot |
557 | 557 | // it will be an empty array if the snapshot and the actual entity do not differ |
558 | - $diff = null; |
|
558 | + $diff = null; |
|
559 | 559 | |
560 | 560 | |
561 | 561 | if ($params == 'declined') { |
562 | - if ($jobEntity instanceOf JobSnapshot) { |
|
562 | + if ($jobEntity instanceOf JobSnapshot) { |
|
563 | 563 | $jobEntity->getOriginalEntity()->changeStatus( |
564 | 564 | Status::ACTIVE, |
565 | 565 | sprintf( |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | */ |
635 | 635 | public function deactivateAction() |
636 | 636 | { |
637 | - $user = $this->auth->getUser(); |
|
637 | + $user = $this->auth->getUser(); |
|
638 | 638 | |
639 | 639 | $jobEntity = $this->initializeJob()->get($this->params()); |
640 | 640 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | * @return \Core\Form\CollectionContainer |
20 | 20 | */ |
21 | 21 | public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { |
22 | - $collectionContainer = new CollectionContainer( 'Cv/LanguageSkillForm', new Language() ); |
|
22 | + $collectionContainer = new CollectionContainer('Cv/LanguageSkillForm', new Language()); |
|
23 | 23 | $collectionContainer->setLabel(/*@translate */ 'Additional Language Skills' ); |
24 | 24 | |
25 | 25 | return $collectionContainer; |
@@ -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 |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | public function gatherContexts(BeforeScenarioScope $scope) |
40 | 40 | { |
41 | 41 | $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class); |
42 | - if(false === static::$jobCategoryChecked){ |
|
42 | + if (false === static::$jobCategoryChecked) { |
|
43 | 43 | /* @var Categories $catRepo */ |
44 | 44 | $catRepo = $this->getRepositories()->get('Jobs/Category'); |
45 | 45 | $all = $catRepo->findAll(); |
46 | - if(count($all) <= 1){ |
|
46 | + if (count($all) <= 1) { |
|
47 | 47 | $catRepo->createDefaultCategory('professions'); |
48 | 48 | $catRepo->createDefaultCategory('industries'); |
49 | 49 | $catRepo->createDefaultCategory('employmentTypes'); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function getApplication() |
59 | 59 | { |
60 | - if(!is_object(static::$application)){ |
|
60 | + if (!is_object(static::$application)) { |
|
61 | 61 | $configFile = realpath(__DIR__.'/../../../config/config.php'); |
62 | 62 | $config = include($configFile); |
63 | 63 | static::$application = Application::init($config); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | public function iSubmitTheFormWithId($arg) |
142 | 142 | { |
143 | 143 | $node = $this->minkContext->getSession()->getPage()->find('css', $arg); |
144 | - if($node) { |
|
144 | + if ($node) { |
|
145 | 145 | $this->minkContext->getSession()->executeScript("jQuery('$arg').submit();"); |
146 | 146 | } else { |
147 | 147 | throw new \Exception('Element not found'); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | public function iSetMainWindowName() |
166 | 166 | { |
167 | 167 | $window_name = 'main_window'; |
168 | - $script = 'window.name = "' . $window_name . '"'; |
|
168 | + $script = 'window.name = "'.$window_name.'"'; |
|
169 | 169 | $this->getSession()->executeScript($script); |
170 | 170 | } |
171 | 171 | |
@@ -224,14 +224,14 @@ discard block |
||
224 | 224 | break; |
225 | 225 | |
226 | 226 | default: |
227 | - throw new \Exception(__METHOD__ . ' Couldn\'t find selector: ' . $selector . ' - Allowed selectors: #id, .className, //xpath'); |
|
227 | + throw new \Exception(__METHOD__.' Couldn\'t find selector: '.$selector.' - Allowed selectors: #id, .className, //xpath'); |
|
228 | 228 | break; |
229 | 229 | } |
230 | 230 | |
231 | 231 | try { |
232 | 232 | $this->getSession()->executeScript($function); |
233 | 233 | } catch (\Exception $e) { |
234 | - throw new \Exception(__METHOD__ . ' failed'. ' Message: for this locator:"'.$selector.'"'); |
|
234 | + throw new \Exception(__METHOD__.' failed'.' Message: for this locator:"'.$selector.'"'); |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | |
@@ -252,10 +252,10 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @return \Behat\Mink\Element\NodeElement|mixed|null |
254 | 254 | */ |
255 | - public function getElement($locator,$selector='css') |
|
255 | + public function getElement($locator, $selector = 'css') |
|
256 | 256 | { |
257 | 257 | $page = $this->minkContext->getSession()->getPage(); |
258 | - $element = $page->find('css',$locator); |
|
258 | + $element = $page->find('css', $locator); |
|
259 | 259 | return $element; |
260 | 260 | } |
261 | 261 | |
@@ -287,12 +287,12 @@ discard block |
||
287 | 287 | $session = $this->getSession(); |
288 | 288 | $element = $session->getPage()->find( |
289 | 289 | 'xpath', |
290 | - $session->getSelectorsHandler()->selectorToXpath('xpath', '*//*[text()="'. $text .'"]') |
|
290 | + $session->getSelectorsHandler()->selectorToXpath('xpath', '*//*[text()="'.$text.'"]') |
|
291 | 291 | ); |
292 | - if(null === $element){ |
|
292 | + if (null === $element) { |
|
293 | 293 | $element = $session->getPage()->find( |
294 | 294 | 'named', |
295 | - array('id',$text) |
|
295 | + array('id', $text) |
|
296 | 296 | ); |
297 | 297 | } |
298 | 298 | if (null === $element) { |
@@ -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 |
@@ -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->generateUrl('lang/apply',[ |
|
44 | + $url = $this->generateUrl('lang/apply', [ |
|
45 | 45 | 'applyId' => $job->getApplyId() |
46 | 46 | ]); |
47 | 47 | $this->visit($url); |
@@ -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 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | static public function restoreConfig() |
94 | 94 | { |
95 | - if(is_file($file = static::$configFile)){ |
|
95 | + if (is_file($file = static::$configFile)) { |
|
96 | 96 | unlink($file); |
97 | 97 | } |
98 | 98 | |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | $yawikBackupConfig = static::$yawikBackupConfig; |
101 | 101 | $yawikGlobalConfig = static::$yawikGlobalConfig; |
102 | 102 | |
103 | - if(is_file($yawikBackupConfig)){ |
|
104 | - rename($yawikBackupConfig,$yawikGlobalConfig); |
|
103 | + if (is_file($yawikBackupConfig)) { |
|
104 | + rename($yawikBackupConfig, $yawikGlobalConfig); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
@@ -112,6 +112,6 @@ discard block |
||
112 | 112 | { |
113 | 113 | $config = $this->getService('config'); |
114 | 114 | $connection = $config['doctrine']['connection']['odm_default']['connectionString']; |
115 | - $this->minkContext->fillField('db_conn',$connection); |
|
115 | + $this->minkContext->fillField('db_conn', $connection); |
|
116 | 116 | } |
117 | 117 | } |
@@ -51,16 +51,16 @@ |
||
51 | 51 | $this->summaryFormContext = $scope->getEnvironment()->getContext(SummaryFormContext::class); |
52 | 52 | } |
53 | 53 | |
54 | - public function generateUrl($name,array $params=array(),array $options=array()) |
|
54 | + public function generateUrl($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 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | protected $currentUser; |
66 | 66 | |
67 | - public function __construct($parameters=[]) |
|
67 | + public function __construct($parameters = []) |
|
68 | 68 | { |
69 | 69 | $defaultLoginInfo = [ |
70 | 70 | 'facebook' => [ |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | 'session_password-login' => getenv('LINKEDIN_USER_PASSWORD') |
77 | 77 | ], |
78 | 78 | ]; |
79 | - $socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info']:[]; |
|
80 | - $this->socialLoginInfo = array_merge($defaultLoginInfo,$socialLoginConfig); |
|
79 | + $socialLoginConfig = isset($parameters['social_login_info']) ? $parameters['social_login_info'] : []; |
|
80 | + $this->socialLoginInfo = array_merge($defaultLoginInfo, $socialLoginConfig); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | static public function afterSuite(AfterSuiteScope $scope) |
88 | 88 | { |
89 | 89 | $repo = static::$userRepo; |
90 | - foreach(static::$users as $user){ |
|
91 | - if($repo->findByLogin($user->getLogin())){ |
|
92 | - try{ |
|
90 | + foreach (static::$users as $user) { |
|
91 | + if ($repo->findByLogin($user->getLogin())) { |
|
92 | + try { |
|
93 | 93 | JobContext::removeJobByUser($user); |
94 | - $repo->remove($user,true); |
|
95 | - }catch (\Exception $e){ |
|
94 | + $repo->remove($user, true); |
|
95 | + } catch (\Exception $e) { |
|
96 | 96 | |
97 | 97 | } |
98 | 98 | } |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | { |
118 | 118 | $provider = strtolower($provider); |
119 | 119 | $mink = $this->minkContext; |
120 | - foreach($this->socialLoginInfo[$provider] as $field=>$value){ |
|
121 | - $mink->fillField($field,$value); |
|
120 | + foreach ($this->socialLoginInfo[$provider] as $field=>$value) { |
|
121 | + $mink->fillField($field, $value); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
@@ -126,15 +126,15 @@ discard block |
||
126 | 126 | * @Given I am logged in as a recruiter |
127 | 127 | * @Given I am logged in as a recruiter with :organization as organization |
128 | 128 | */ |
129 | - public function iAmLoggedInAsARecruiter($organization=null) |
|
129 | + public function iAmLoggedInAsARecruiter($organization = null) |
|
130 | 130 | { |
131 | 131 | $user = $this->thereIsAUserIdentifiedBy( |
132 | 132 | '[email protected]', |
133 | - 'test',User::ROLE_RECRUITER, |
|
133 | + 'test', User::ROLE_RECRUITER, |
|
134 | 134 | 'Test Recruiter', |
135 | 135 | $organization |
136 | 136 | ); |
137 | - $this->startLogin($user,'test'); |
|
137 | + $this->startLogin($user, 'test'); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | public function iDonTHaveUser($login) |
145 | 145 | { |
146 | 146 | $repo = $this->getUserRepository(); |
147 | - $user=$repo->findByLogin($login); |
|
148 | - if($user instanceof UserInterface){ |
|
149 | - $repo->remove($user,true); |
|
147 | + $user = $repo->findByLogin($login); |
|
148 | + if ($user instanceof UserInterface) { |
|
149 | + $repo->remove($user, true); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @param $role |
156 | 156 | * @param TableNode $fields |
157 | 157 | */ |
158 | - public function iHaveUserWithTheFollowing($role,TableNode $fields) |
|
158 | + public function iHaveUserWithTheFollowing($role, TableNode $fields) |
|
159 | 159 | { |
160 | 160 | $normalizedFields = [ |
161 | 161 | 'login' => '[email protected]', |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | 'password' => 'test', |
165 | 165 | 'organization' => 'Cross Solution' |
166 | 166 | ]; |
167 | - foreach($fields->getRowsHash() as $field=>$value){ |
|
167 | + foreach ($fields->getRowsHash() as $field=>$value) { |
|
168 | 168 | $field = Inflector::camelize($field); |
169 | 169 | $normalizedFields[$field] = $value; |
170 | 170 | } |
@@ -184,14 +184,14 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function iAmLoggedInAsAnAdmin() |
186 | 186 | { |
187 | - $user = $this->thereIsAUserIdentifiedBy('[email protected]','test',User::ROLE_ADMIN); |
|
188 | - $this->startLogin($user,'test'); |
|
187 | + $user = $this->thereIsAUserIdentifiedBy('[email protected]', 'test', User::ROLE_ADMIN); |
|
188 | + $this->startLogin($user, 'test'); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | private function startLogin(UserInterface $user, $password) |
192 | 192 | { |
193 | 193 | $currentUser = $this->currentUser; |
194 | - if(!is_object($currentUser) || $user->getId()!=$currentUser->getId()){ |
|
194 | + if (!is_object($currentUser) || $user->getId() != $currentUser->getId()) { |
|
195 | 195 | $this->iWantToLogIn(); |
196 | 196 | $this->iSpecifyTheUsernameAs($user->getLogin()); |
197 | 197 | $this->iSpecifyThePasswordAs($password); |
@@ -211,15 +211,15 @@ discard block |
||
211 | 211 | /** |
212 | 212 | * @Given there is a user :email identified by :password |
213 | 213 | */ |
214 | - public function thereIsAUserIdentifiedBy($email, $password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter",$organization=null) |
|
214 | + public function thereIsAUserIdentifiedBy($email, $password, $role = User::ROLE_RECRUITER, $fullname = "Test Recruiter", $organization = null) |
|
215 | 215 | { |
216 | 216 | $repo = $this->getUserRepository(); |
217 | - if(!is_object($user=$repo->findByEmail($email))){ |
|
218 | - $user = $this->createUser($email,$password,$role,$fullname,$organization); |
|
217 | + if (!is_object($user = $repo->findByEmail($email))) { |
|
218 | + $user = $this->createUser($email, $password, $role, $fullname, $organization); |
|
219 | 219 | } |
220 | 220 | |
221 | - if(!is_null($organization)){ |
|
222 | - $this->iHaveMainOrganization($user,$organization); |
|
221 | + if (!is_null($organization)) { |
|
222 | + $this->iHaveMainOrganization($user, $organization); |
|
223 | 223 | } |
224 | 224 | $this->addCreatedUser($user); |
225 | 225 | return $user; |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * |
235 | 235 | * @return \Auth\Entity\UserInterface |
236 | 236 | */ |
237 | - public function createUser($email,$password,$role=User::ROLE_RECRUITER,$fullname="Test Recruiter") |
|
237 | + public function createUser($email, $password, $role = User::ROLE_RECRUITER, $fullname = "Test Recruiter") |
|
238 | 238 | { |
239 | 239 | /* @var Register $service */ |
240 | 240 | /* @var User $user */ |
@@ -245,10 +245,10 @@ discard block |
||
245 | 245 | $user->setRole($role); |
246 | 246 | $settings = $user->getSettings('Applications'); |
247 | 247 | |
248 | - $expFullName = explode(' ',$fullname); |
|
248 | + $expFullName = explode(' ', $fullname); |
|
249 | 249 | $info = $user->getInfo(); |
250 | 250 | $info->setFirstName(array_shift($expFullName)); |
251 | - $info->setLastName(count($expFullName)>0 ? implode(' ',$expFullName):''); |
|
251 | + $info->setLastName(count($expFullName) > 0 ? implode(' ', $expFullName) : ''); |
|
252 | 252 | $info->setEmail($email); |
253 | 253 | $info->setEmailVerified(true); |
254 | 254 | $repo->store($user); |
@@ -273,19 +273,19 @@ discard block |
||
273 | 273 | * @When I have :organization as my main organization |
274 | 274 | * @param $orgName |
275 | 275 | */ |
276 | - public function iHaveMainOrganization(UserInterface $user,$orgName) |
|
276 | + public function iHaveMainOrganization(UserInterface $user, $orgName) |
|
277 | 277 | { |
278 | 278 | /* @var $repoOrganization OrganizationRepository */ |
279 | 279 | $repoOrganization = $this->coreContext->getRepositories()->get('Organizations/Organization'); |
280 | - $organization=$repoOrganization->findByName($orgName); |
|
281 | - if(!$organization instanceof Organization){ |
|
280 | + $organization = $repoOrganization->findByName($orgName); |
|
281 | + if (!$organization instanceof Organization) { |
|
282 | 282 | $organization = new Organization(); |
283 | 283 | $organizationName = new OrganizationName($orgName); |
284 | 284 | $organization->setOrganizationName($organizationName); |
285 | 285 | $permissions = $organization->getPermissions(); |
286 | - $permissions->grant($user,Permissions::PERMISSION_ALL); |
|
287 | - }else { |
|
288 | - $organization->getPermissions()->grant($user,Permissions::PERMISSION_ALL); |
|
286 | + $permissions->grant($user, Permissions::PERMISSION_ALL); |
|
287 | + } else { |
|
288 | + $organization->getPermissions()->grant($user, Permissions::PERMISSION_ALL); |
|
289 | 289 | } |
290 | 290 | $organization->setUser($user); |
291 | 291 | $repoOrganization->store($organization); |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | */ |
308 | 308 | public function iSpecifyTheUsernameAs($username) |
309 | 309 | { |
310 | - $this->minkContext->fillField('Login name',$username); |
|
310 | + $this->minkContext->fillField('Login name', $username); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | */ |
316 | 316 | public function iSpecifyThePasswordAs($password) |
317 | 317 | { |
318 | - $this->minkContext->fillField('Password',$password); |
|
318 | + $this->minkContext->fillField('Password', $password); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | /** |
@@ -326,8 +326,8 @@ discard block |
||
326 | 326 | $repo = $this->getUserRepository(); |
327 | 327 | $user = $repo->findByLogin($username); |
328 | 328 | |
329 | - if(!$user instanceof User){ |
|
330 | - throw new \Exception(sprintf('There is no user with this login: "%s"',$username)); |
|
329 | + if (!$user instanceof User) { |
|
330 | + throw new \Exception(sprintf('There is no user with this login: "%s"', $username)); |
|
331 | 331 | } |
332 | 332 | $this->iWantToLogIn(); |
333 | 333 | $this->iSpecifyTheUsernameAs($username); |
@@ -383,13 +383,13 @@ discard block |
||
383 | 383 | { |
384 | 384 | $repo = $this->getUserRepository(); |
385 | 385 | $data = $table->getRowsHash(); |
386 | - $email = isset($data['email']) ? $data['email']:'[email protected]'; |
|
387 | - $password = isset($data['password']) ? $data['password']:'test'; |
|
388 | - $fullname = isset($data['fullname']) ? $data['fullname']:'Test User'; |
|
389 | - $role = isset($data['role']) ? $data['role']:User::ROLE_RECRUITER; |
|
386 | + $email = isset($data['email']) ? $data['email'] : '[email protected]'; |
|
387 | + $password = isset($data['password']) ? $data['password'] : 'test'; |
|
388 | + $fullname = isset($data['fullname']) ? $data['fullname'] : 'Test User'; |
|
389 | + $role = isset($data['role']) ? $data['role'] : User::ROLE_RECRUITER; |
|
390 | 390 | |
391 | - if(!is_object($user=$repo->findByLogin($email))){ |
|
392 | - $user = $this->createUser($email,$password,$role,$fullname); |
|
391 | + if (!is_object($user = $repo->findByLogin($email))) { |
|
392 | + $user = $this->createUser($email, $password, $role, $fullname); |
|
393 | 393 | } |
394 | 394 | $this->currentUser = $user; |
395 | 395 | $this->addCreatedUser($user); |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | |
398 | 398 | private function addCreatedUser(UserInterface $user) |
399 | 399 | { |
400 | - if(!in_array($user,static::$users)){ |
|
400 | + if (!in_array($user, static::$users)) { |
|
401 | 401 | static::$users[] = $user; |
402 | 402 | } |
403 | 403 | } |