@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function getConsoleBanner(Console $console) |
42 | 42 | { |
43 | 43 | $version = `git describe 2>/dev/null`; |
44 | - $name = 'YAWIK ' . trim($version); |
|
44 | + $name = 'YAWIK '.trim($version); |
|
45 | 45 | $width = $console->getWidth(); |
46 | 46 | return sprintf( |
47 | 47 | "==%1\$s==\n%2\$s%3\$s\n**%1\$s**\n", |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | /* @var \Core\Options\ModuleOptions $options */ |
86 | 86 | $languageRouteListener = new LanguageRouteListener( |
87 | - $sm->get('Core/Locale'),$sm->get('Core/Options') |
|
87 | + $sm->get('Core/Locale'), $sm->get('Core/Options') |
|
88 | 88 | ); |
89 | 89 | $languageRouteListener->attach($eventManager); |
90 | 90 | |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | |
114 | 114 | $eventManager->attach( |
115 | 115 | MvcEvent::EVENT_DISPATCH_ERROR, |
116 | - function ($event) { |
|
117 | - if($event instanceof MvcEvent){ |
|
116 | + function($event) { |
|
117 | + if ($event instanceof MvcEvent) { |
|
118 | 118 | $application = $event->getApplication(); |
119 | 119 | |
120 | 120 | if ($application::ERROR_EXCEPTION == $event->getError()) { |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | ); |
130 | 130 | $eventManager->attach( |
131 | 131 | MvcEvent::EVENT_DISPATCH, |
132 | - function ($event) use ($eventManager) { |
|
132 | + function($event) use ($eventManager) { |
|
133 | 133 | $eventManager->trigger('postDispatch', $event); |
134 | 134 | }, |
135 | 135 | -150 |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function getConfig() |
146 | 146 | { |
147 | - $config = include __DIR__ . '/config/module.config.php'; |
|
147 | + $config = include __DIR__.'/config/module.config.php'; |
|
148 | 148 | return $config; |
149 | 149 | } |
150 | 150 | |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | { |
158 | 158 | return array( |
159 | 159 | 'Zend\Loader\ClassMapAutoloader' => [ |
160 | - __DIR__ . '/src/autoload_classmap.php' |
|
160 | + __DIR__.'/src/autoload_classmap.php' |
|
161 | 161 | ], |
162 | 162 | 'Zend\Loader\StandardAutoloader' => array( |
163 | 163 | 'namespaces' => array( |
164 | - __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, |
|
165 | - 'CoreTest' => __DIR__ . '/test/' . 'CoreTest', |
|
166 | - 'CoreTestUtils' => __DIR__ . '/test/CoreTestUtils', |
|
164 | + __NAMESPACE__ => __DIR__.'/src/'.__NAMESPACE__, |
|
165 | + 'CoreTest' => __DIR__.'/test/'.'CoreTest', |
|
166 | + 'CoreTestUtils' => __DIR__.'/test/CoreTestUtils', |
|
167 | 167 | ), |
168 | 168 | ), |
169 | 169 | ); |
@@ -124,10 +124,10 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | $router = $e->getRouter(); |
127 | - $basePath=$router->getBaseUrl(); |
|
127 | + $basePath = $router->getBaseUrl(); |
|
128 | 128 | $match = []; |
129 | 129 | |
130 | - if (preg_match('~^' . $basePath . '/([a-z]{2})(?:/|$)~', $e->getRequest()->getRequestUri(), $match)) { |
|
130 | + if (preg_match('~^'.$basePath.'/([a-z]{2})(?:/|$)~', $e->getRequest()->getRequestUri(), $match)) { |
|
131 | 131 | /* It seems we have already a language in the URI |
132 | 132 | * Now there are two possibilities: |
133 | 133 | * |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | $options = $this->moduleOptions; |
163 | 163 | // using default language if detect language is disabled |
164 | - $lang = $options->isDetectLanguage() ? $this->detectLanguage($e):$options->getDefaultLanguage(); |
|
164 | + $lang = $options->isDetectLanguage() ? $this->detectLanguage($e) : $options->getDefaultLanguage(); |
|
165 | 165 | $langUri = rtrim("$basePath/$lang$origUri", '/'); |
166 | 166 | if ($router->match($request->setUri($langUri)) instanceof RouteMatch) { |
167 | 167 | $e->stopPropagation(true); |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | setlocale( |
213 | 213 | LC_ALL, |
214 | 214 | array( |
215 | - $locale . ".utf8", |
|
216 | - $locale . ".iso88591", |
|
215 | + $locale.".utf8", |
|
216 | + $locale.".iso88591", |
|
217 | 217 | $locale, |
218 | 218 | substr($locale, 0, 2), |
219 | 219 | 'de_DE.utf8', |
@@ -32,7 +32,7 @@ |
||
32 | 32 | { |
33 | 33 | $options = $this->options; |
34 | 34 | $filename = call_user_func($options->getCallback(), $this); |
35 | - $file = $options->getPath() . DIRECTORY_SEPARATOR . $filename; |
|
35 | + $file = $options->getPath().DIRECTORY_SEPARATOR.$filename; |
|
36 | 36 | |
37 | 37 | |
38 | 38 | $contents = $message->toString(); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | class MailServiceFactory implements FactoryInterface |
28 | 28 | { |
29 | - public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
29 | + public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
|
30 | 30 | { |
31 | 31 | $config = $container->get('Config'); |
32 | 32 | $mails = isset($config['mails']) ? $config['mails'] : []; |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | $configArray = array_merge($configArray, $mails); |
49 | 49 | |
50 | 50 | $config = new MailServiceConfig($configArray); |
51 | - $service = new MailService($container,$config->toArray()); |
|
51 | + $service = new MailService($container, $config->toArray()); |
|
52 | 52 | $config->configureServiceManager($service); |
53 | - foreach($config->toArray() as $name=>$value){ |
|
53 | + foreach ($config->toArray() as $name=>$value) { |
|
54 | 54 | $method = 'set'.$name; |
55 | - if(method_exists($service,$method)){ |
|
56 | - call_user_func([$service,$method],$value); |
|
55 | + if (method_exists($service, $method)) { |
|
56 | + call_user_func([$service, $method], $value); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | $type = $mailServiceOptions->getTransportClass(); |
66 | 66 | if (MailService::TRANSPORT_SMTP == $type) { |
67 | 67 | return new Smtp($mailServiceOptions); |
68 | - }elseif(MailService::TRANSPORT_FILE == $type){ |
|
68 | + }elseif (MailService::TRANSPORT_FILE == $type) { |
|
69 | 69 | $fileOptions = new FileOptions(); |
70 | 70 | $fileOptions->setPath($mailServiceOptions->getPath()); |
71 | 71 | return new FileTransport($fileOptions); |
72 | - }elseif(MailService::TRANSPORT_SENDMAIL == $type){ |
|
72 | + }elseif (MailService::TRANSPORT_SENDMAIL == $type) { |
|
73 | 73 | return new Sendmail(); |
74 | 74 | } |
75 | 75 |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | return $this; |
100 | 100 | } |
101 | 101 | |
102 | - public function getUsername(){ |
|
102 | + public function getUsername() { |
|
103 | 103 | return $this->connectionConfig['username']; |
104 | 104 | } |
105 | 105 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | return $this; |
111 | 111 | } |
112 | 112 | |
113 | - public function getPassword(){ |
|
113 | + public function getPassword() { |
|
114 | 114 | return $this->connectionConfig['password']; |
115 | 115 | } |
116 | 116 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | return $this; |
122 | 122 | } |
123 | 123 | |
124 | - public function getSsl(){ |
|
124 | + public function getSsl() { |
|
125 | 125 | return $this->connectionConfig['ssl']; |
126 | 126 | } |
127 | 127 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | return $this; |
131 | 131 | } |
132 | 132 | |
133 | - public function getTransportClass(){ |
|
133 | + public function getTransportClass() { |
|
134 | 134 | return $this->transportClass; |
135 | 135 | } |
136 | 136 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function getPath() |
141 | 141 | { |
142 | - if(is_null($this->path)){ |
|
142 | + if (is_null($this->path)) { |
|
143 | 143 | $this->setPath(sys_get_temp_dir().'/yawik/mails'); |
144 | 144 | } |
145 | 145 | return $this->path; |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function setPath($path) |
153 | 153 | { |
154 | - if(!is_dir($path)){ |
|
155 | - mkdir($path,0777,true); |
|
156 | - chmod($path,0777); |
|
154 | + if (!is_dir($path)) { |
|
155 | + mkdir($path, 0777, true); |
|
156 | + chmod($path, 0777); |
|
157 | 157 | } |
158 | 158 | $this->path = $path; |
159 | 159 | return $this; |
@@ -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) |
@@ -47,17 +47,17 @@ discard block |
||
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 |
||
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 |
||
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 | /** |
@@ -24,7 +24,7 @@ |
||
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; |
@@ -63,7 +63,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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,20 +286,20 @@ 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 | 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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |