@@ -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; |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | private $orgRepo; |
37 | 37 | |
38 | - public function __construct( |
|
38 | + public function __construct( |
|
39 | 39 | OrganizationRepository $orgRepo |
40 | 40 | ) |
41 | 41 | { |
@@ -51,6 +51,9 @@ discard block |
||
51 | 51 | $this->summaryFormContext = $scope->getEnvironment()->getContext(SummaryFormContext::class); |
52 | 52 | } |
53 | 53 | |
54 | + /** |
|
55 | + * @param string $name |
|
56 | + */ |
|
54 | 57 | public function buildUrl($name, array $params=array(), array $options=array()) |
55 | 58 | { |
56 | 59 | $defaults = ['lang'=>'en']; |
@@ -71,7 +74,7 @@ discard block |
||
71 | 74 | } |
72 | 75 | |
73 | 76 | /** |
74 | - * @param $id |
|
77 | + * @param string $id |
|
75 | 78 | * @return mixed|object |
76 | 79 | */ |
77 | 80 | public function getService($id) |
@@ -80,7 +83,7 @@ discard block |
||
80 | 83 | } |
81 | 84 | |
82 | 85 | /** |
83 | - * @param $id |
|
86 | + * @param string $id |
|
84 | 87 | * |
85 | 88 | * @return RepositoryInterface |
86 | 89 | */ |
@@ -18,43 +18,43 @@ discard block |
||
18 | 18 | |
19 | 19 | trait CommonContextTrait |
20 | 20 | { |
21 | - /** |
|
22 | - * @var MinkContext |
|
23 | - */ |
|
24 | - protected $minkContext; |
|
21 | + /** |
|
22 | + * @var MinkContext |
|
23 | + */ |
|
24 | + protected $minkContext; |
|
25 | 25 | |
26 | - /** |
|
27 | - * @var CoreContext |
|
28 | - */ |
|
29 | - protected $coreContext; |
|
26 | + /** |
|
27 | + * @var CoreContext |
|
28 | + */ |
|
29 | + protected $coreContext; |
|
30 | 30 | |
31 | - /** |
|
32 | - * @var UserContext |
|
33 | - */ |
|
34 | - protected $userContext; |
|
31 | + /** |
|
32 | + * @var UserContext |
|
33 | + */ |
|
34 | + protected $userContext; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @var SummaryFormContext |
|
38 | - */ |
|
39 | - protected $summaryFormContext; |
|
36 | + /** |
|
37 | + * @var SummaryFormContext |
|
38 | + */ |
|
39 | + protected $summaryFormContext; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @BeforeScenario |
|
43 | - * |
|
44 | - * @param BeforeScenarioScope $scope |
|
45 | - */ |
|
46 | - final public function gatherContexts(BeforeScenarioScope $scope) |
|
47 | - { |
|
48 | - $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class); |
|
49 | - $this->coreContext = $scope->getEnvironment()->getContext(CoreContext::class); |
|
50 | - $this->userContext = $scope->getEnvironment()->getContext(UserContext::class); |
|
51 | - $this->summaryFormContext = $scope->getEnvironment()->getContext(SummaryFormContext::class); |
|
52 | - } |
|
41 | + /** |
|
42 | + * @BeforeScenario |
|
43 | + * |
|
44 | + * @param BeforeScenarioScope $scope |
|
45 | + */ |
|
46 | + final public function gatherContexts(BeforeScenarioScope $scope) |
|
47 | + { |
|
48 | + $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class); |
|
49 | + $this->coreContext = $scope->getEnvironment()->getContext(CoreContext::class); |
|
50 | + $this->userContext = $scope->getEnvironment()->getContext(UserContext::class); |
|
51 | + $this->summaryFormContext = $scope->getEnvironment()->getContext(SummaryFormContext::class); |
|
52 | + } |
|
53 | 53 | |
54 | - public function buildUrl($name, array $params=array(), array $options=array()) |
|
55 | - { |
|
56 | - $defaults = ['lang'=>'en']; |
|
57 | - $params = array_merge($defaults,$params); |
|
54 | + public function buildUrl($name, array $params=array(), array $options=array()) |
|
55 | + { |
|
56 | + $defaults = ['lang'=>'en']; |
|
57 | + $params = array_merge($defaults,$params); |
|
58 | 58 | /* @var Url $urlHelper */ |
59 | 59 | $urlHelper = $this |
60 | 60 | ->getService('ViewHelperManager') |
@@ -63,36 +63,36 @@ discard block |
||
63 | 63 | $url = $urlHelper($name,$params,$options); |
64 | 64 | |
65 | 65 | return $this->coreContext->generateUrl($url); |
66 | - } |
|
66 | + } |
|
67 | 67 | |
68 | - public function visit($url) |
|
69 | - { |
|
70 | - $this->coreContext->iVisit($url); |
|
71 | - } |
|
68 | + public function visit($url) |
|
69 | + { |
|
70 | + $this->coreContext->iVisit($url); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * @param $id |
|
75 | - * @return mixed|object |
|
76 | - */ |
|
77 | - public function getService($id) |
|
78 | - { |
|
79 | - return $this->coreContext->getServiceManager()->get($id); |
|
80 | - } |
|
73 | + /** |
|
74 | + * @param $id |
|
75 | + * @return mixed|object |
|
76 | + */ |
|
77 | + public function getService($id) |
|
78 | + { |
|
79 | + return $this->coreContext->getServiceManager()->get($id); |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @param $id |
|
84 | - * |
|
85 | - * @return RepositoryInterface |
|
86 | - */ |
|
87 | - public function getRepository($id) |
|
88 | - { |
|
89 | - return $this->coreContext->getRepositories()->get($id); |
|
90 | - } |
|
82 | + /** |
|
83 | + * @param $id |
|
84 | + * |
|
85 | + * @return RepositoryInterface |
|
86 | + */ |
|
87 | + public function getRepository($id) |
|
88 | + { |
|
89 | + return $this->coreContext->getRepositories()->get($id); |
|
90 | + } |
|
91 | 91 | |
92 | 92 | /** |
93 | 93 | * @return UserContext |
94 | 94 | */ |
95 | - public function getUserContext() |
|
95 | + public function getUserContext() |
|
96 | 96 | { |
97 | 97 | return $this->userContext; |
98 | 98 | } |
@@ -51,16 +51,16 @@ |
||
51 | 51 | $this->summaryFormContext = $scope->getEnvironment()->getContext(SummaryFormContext::class); |
52 | 52 | } |
53 | 53 | |
54 | - public function buildUrl($name, array $params=array(), array $options=array()) |
|
54 | + public function buildUrl($name, array $params = array(), array $options = array()) |
|
55 | 55 | { |
56 | 56 | $defaults = ['lang'=>'en']; |
57 | - $params = array_merge($defaults,$params); |
|
57 | + $params = array_merge($defaults, $params); |
|
58 | 58 | /* @var Url $urlHelper */ |
59 | 59 | $urlHelper = $this |
60 | 60 | ->getService('ViewHelperManager') |
61 | 61 | ->get('url') |
62 | 62 | ; |
63 | - $url = $urlHelper($name,$params,$options); |
|
63 | + $url = $urlHelper($name, $params, $options); |
|
64 | 64 | |
65 | 65 | return $this->coreContext->generateUrl($url); |
66 | 66 | } |
@@ -14,26 +14,26 @@ |
||
14 | 14 | |
15 | 15 | class SettingsContext implements Context |
16 | 16 | { |
17 | - use CommonContextTrait; |
|
17 | + use CommonContextTrait; |
|
18 | 18 | |
19 | - /** |
|
20 | - * @Given I go to settings page |
|
21 | - */ |
|
22 | - public function iGoToSettingsPage() |
|
23 | - { |
|
24 | - //$this->visit('/settings'); |
|
19 | + /** |
|
20 | + * @Given I go to settings page |
|
21 | + */ |
|
22 | + public function iGoToSettingsPage() |
|
23 | + { |
|
24 | + //$this->visit('/settings'); |
|
25 | 25 | $url = $this->buildUrl('lang/settings'); |
26 | 26 | $this->visit($url); |
27 | - } |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * @Given I go to email template settings page |
|
31 | - */ |
|
32 | - public function iGoToEmailTemplatePage() |
|
33 | - { |
|
34 | - $url = $this->buildUrl('lang/settings',[ |
|
35 | - 'module' => 'Applications' |
|
29 | + /** |
|
30 | + * @Given I go to email template settings page |
|
31 | + */ |
|
32 | + public function iGoToEmailTemplatePage() |
|
33 | + { |
|
34 | + $url = $this->buildUrl('lang/settings',[ |
|
35 | + 'module' => 'Applications' |
|
36 | 36 | ]); |
37 | - $this->visit($url); |
|
38 | - } |
|
37 | + $this->visit($url); |
|
38 | + } |
|
39 | 39 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | public function iGoToEmailTemplatePage() |
33 | 33 | { |
34 | - $url = $this->buildUrl('lang/settings',[ |
|
34 | + $url = $this->buildUrl('lang/settings', [ |
|
35 | 35 | 'module' => 'Applications' |
36 | 36 | ]); |
37 | 37 | $this->visit($url); |
@@ -22,37 +22,37 @@ |
||
22 | 22 | */ |
23 | 23 | class ApplicationContext implements Context |
24 | 24 | { |
25 | - use CommonContextTrait; |
|
25 | + use CommonContextTrait; |
|
26 | 26 | |
27 | - /** |
|
28 | - * @Given I apply for :title job |
|
29 | - * |
|
30 | - * @param string $title |
|
31 | - * @throws \Exception when the titled job not exists |
|
32 | - */ |
|
33 | - public function iApplyAJob($title) |
|
34 | - { |
|
35 | - /* @var $repo JobRepository */ |
|
36 | - $repo = $this->getRepository('Jobs/Job'); |
|
37 | - $job = $repo->findOneBy(['title' => $title]); |
|
38 | - if(!$job instanceof Job){ |
|
39 | - throw new \Exception('There is no job titled: "'.$title.'"'); |
|
40 | - } |
|
41 | - $job->setApplyId($job->getId()); |
|
42 | - $repo->store($job); |
|
27 | + /** |
|
28 | + * @Given I apply for :title job |
|
29 | + * |
|
30 | + * @param string $title |
|
31 | + * @throws \Exception when the titled job not exists |
|
32 | + */ |
|
33 | + public function iApplyAJob($title) |
|
34 | + { |
|
35 | + /* @var $repo JobRepository */ |
|
36 | + $repo = $this->getRepository('Jobs/Job'); |
|
37 | + $job = $repo->findOneBy(['title' => $title]); |
|
38 | + if(!$job instanceof Job){ |
|
39 | + throw new \Exception('There is no job titled: "'.$title.'"'); |
|
40 | + } |
|
41 | + $job->setApplyId($job->getId()); |
|
42 | + $repo->store($job); |
|
43 | 43 | |
44 | - $url = $this->buildUrl('lang/apply',[ |
|
45 | - 'applyId' => $job->getApplyId() |
|
44 | + $url = $this->buildUrl('lang/apply',[ |
|
45 | + 'applyId' => $job->getApplyId() |
|
46 | 46 | ]); |
47 | - $this->visit($url); |
|
48 | - } |
|
47 | + $this->visit($url); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @Given I visit job categories |
|
52 | - */ |
|
53 | - public function visitJobsCategories() |
|
54 | - { |
|
55 | - $url = '/admin/jobs/categories'; |
|
56 | - $this->visit($url); |
|
57 | - } |
|
50 | + /** |
|
51 | + * @Given I visit job categories |
|
52 | + */ |
|
53 | + public function visitJobsCategories() |
|
54 | + { |
|
55 | + $url = '/admin/jobs/categories'; |
|
56 | + $this->visit($url); |
|
57 | + } |
|
58 | 58 | } |
@@ -35,13 +35,13 @@ |
||
35 | 35 | /* @var $repo JobRepository */ |
36 | 36 | $repo = $this->getRepository('Jobs/Job'); |
37 | 37 | $job = $repo->findOneBy(['title' => $title]); |
38 | - if(!$job instanceof Job){ |
|
38 | + if (!$job instanceof Job) { |
|
39 | 39 | throw new \Exception('There is no job titled: "'.$title.'"'); |
40 | 40 | } |
41 | 41 | $job->setApplyId($job->getId()); |
42 | 42 | $repo->store($job); |
43 | 43 | |
44 | - $url = $this->buildUrl('lang/apply',[ |
|
44 | + $url = $this->buildUrl('lang/apply', [ |
|
45 | 45 | 'applyId' => $job->getApplyId() |
46 | 46 | ]); |
47 | 47 | $this->visit($url); |
@@ -22,23 +22,23 @@ |
||
22 | 22 | */ |
23 | 23 | class CvContext implements Context |
24 | 24 | { |
25 | - use CommonContextTrait; |
|
25 | + use CommonContextTrait; |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * @Given I go to manage my resume page |
|
30 | - */ |
|
31 | - public function iGoToManageResumePage() |
|
32 | - { |
|
33 | - $url = $this->buildUrl('lang/my-cv'); |
|
34 | - $this->visit($url); |
|
35 | - } |
|
28 | + /** |
|
29 | + * @Given I go to manage my resume page |
|
30 | + */ |
|
31 | + public function iGoToManageResumePage() |
|
32 | + { |
|
33 | + $url = $this->buildUrl('lang/my-cv'); |
|
34 | + $this->visit($url); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * @When I click edit on my personal information |
|
39 | - */ |
|
40 | - public function iClickEditOnPersonalInformations() |
|
41 | - { |
|
42 | - $this->summaryFormContext->iClickEditOnForm('resumePersonalInformations'); |
|
43 | - } |
|
37 | + /** |
|
38 | + * @When I click edit on my personal information |
|
39 | + */ |
|
40 | + public function iClickEditOnPersonalInformations() |
|
41 | + { |
|
42 | + $this->summaryFormContext->iClickEditOnForm('resumePersonalInformations'); |
|
43 | + } |
|
44 | 44 | } |
@@ -27,48 +27,48 @@ discard block |
||
27 | 27 | */ |
28 | 28 | class LazyControllerFactory implements AbstractFactoryInterface |
29 | 29 | { |
30 | - protected $aliases = [ |
|
31 | - FormElementManager::class => 'FormElementManager', |
|
32 | - ValidatorPluginManager::class => 'ValidatorManager', |
|
33 | - Translator::class => 'translator', |
|
34 | - ModuleManagerInterface::class => 'ModuleManager', |
|
35 | - EventManager::class => 'Core/EventManager', |
|
30 | + protected $aliases = [ |
|
31 | + FormElementManager::class => 'FormElementManager', |
|
32 | + ValidatorPluginManager::class => 'ValidatorManager', |
|
33 | + Translator::class => 'translator', |
|
34 | + ModuleManagerInterface::class => 'ModuleManager', |
|
35 | + EventManager::class => 'Core/EventManager', |
|
36 | 36 | RepositoryService::class => 'repositories', |
37 | - ]; |
|
37 | + ]; |
|
38 | 38 | |
39 | - public function canCreate( ContainerInterface $container, $requestedName ) |
|
40 | - { |
|
41 | - return strstr( $requestedName,'\Controller') !== false; |
|
42 | - } |
|
39 | + public function canCreate( ContainerInterface $container, $requestedName ) |
|
40 | + { |
|
41 | + return strstr( $requestedName,'\Controller') !== false; |
|
42 | + } |
|
43 | 43 | |
44 | - public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
45 | - { |
|
44 | + public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
45 | + { |
|
46 | 46 | $className = $this->getClassName($requestedName); |
47 | - $class = new \ReflectionClass($className); |
|
47 | + $class = new \ReflectionClass($className); |
|
48 | 48 | |
49 | - if( $constructor = $class->getConstructor() ) |
|
50 | - { |
|
51 | - if( $params = $constructor->getParameters() ) |
|
52 | - { |
|
53 | - $constructorArgs = []; |
|
54 | - foreach( $params as $p ) |
|
55 | - { |
|
56 | - $serviceName = ''; |
|
57 | - if( $p->getClass() ) { |
|
58 | - $serviceName = $p->getClass()->getName(); |
|
59 | - if (array_key_exists($serviceName, $this->aliases)) { |
|
60 | - $serviceName = $this->aliases[$serviceName]; |
|
61 | - } |
|
62 | - } |
|
63 | - else{ |
|
64 | - if( $p->getName() == 'config' ){ |
|
49 | + if( $constructor = $class->getConstructor() ) |
|
50 | + { |
|
51 | + if( $params = $constructor->getParameters() ) |
|
52 | + { |
|
53 | + $constructorArgs = []; |
|
54 | + foreach( $params as $p ) |
|
55 | + { |
|
56 | + $serviceName = ''; |
|
57 | + if( $p->getClass() ) { |
|
58 | + $serviceName = $p->getClass()->getName(); |
|
59 | + if (array_key_exists($serviceName, $this->aliases)) { |
|
60 | + $serviceName = $this->aliases[$serviceName]; |
|
61 | + } |
|
62 | + } |
|
63 | + else{ |
|
64 | + if( $p->getName() == 'config' ){ |
|
65 | 65 | $serviceName = 'config'; |
66 | 66 | } |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | - if(!$container->has($serviceName)){ |
|
70 | - throw new ServiceNotCreatedException(sprintf( |
|
71 | - 'Can\'t create constructor argument "%s" for service "%s"', |
|
69 | + if(!$container->has($serviceName)){ |
|
70 | + throw new ServiceNotCreatedException(sprintf( |
|
71 | + 'Can\'t create constructor argument "%s" for service "%s"', |
|
72 | 72 | $p->getName(),$requestedName |
73 | 73 | )); |
74 | 74 | } |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | echo __CLASS__ . " couldn't create an instance of {$p->getName()} to satisfy the constructor for $requestedName."; |
80 | 80 | exit; |
81 | 81 | } |
82 | - } |
|
83 | - return $class->newInstanceArgs($constructorArgs); |
|
84 | - } |
|
85 | - } |
|
82 | + } |
|
83 | + return $class->newInstanceArgs($constructorArgs); |
|
84 | + } |
|
85 | + } |
|
86 | 86 | |
87 | - return new $className; |
|
88 | - } |
|
87 | + return new $className; |
|
88 | + } |
|
89 | 89 | |
90 | 90 | /** |
91 | 91 | * Generate class name |
@@ -36,47 +36,47 @@ discard block |
||
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 |
||
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"', |
@@ -59,8 +59,7 @@ discard block |
||
59 | 59 | if (array_key_exists($serviceName, $this->aliases)) { |
60 | 60 | $serviceName = $this->aliases[$serviceName]; |
61 | 61 | } |
62 | - } |
|
63 | - else{ |
|
62 | + } else{ |
|
64 | 63 | if( $p->getName() == 'config' ){ |
65 | 64 | $serviceName = 'config'; |
66 | 65 | } |
@@ -74,8 +73,7 @@ discard block |
||
74 | 73 | } |
75 | 74 | try { |
76 | 75 | $constructorArgs[] = $container->get($serviceName); |
77 | - } |
|
78 | - catch (\Exception $x) { |
|
76 | + } catch (\Exception $x) { |
|
79 | 77 | echo __CLASS__ . " couldn't create an instance of {$p->getName()} to satisfy the constructor for $requestedName."; |
80 | 78 | exit; |
81 | 79 | } |
@@ -25,24 +25,24 @@ discard block |
||
25 | 25 | */ |
26 | 26 | class IndexController extends AbstractActionController |
27 | 27 | { |
28 | - /** @var DefaultListener */ |
|
29 | - private $defaultListener; |
|
28 | + /** @var DefaultListener */ |
|
29 | + private $defaultListener; |
|
30 | 30 | |
31 | - private $config; |
|
31 | + private $config; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @var ModuleManager |
|
35 | - */ |
|
36 | - private $moduleManager; |
|
33 | + /** |
|
34 | + * @var ModuleManager |
|
35 | + */ |
|
36 | + private $moduleManager; |
|
37 | 37 | |
38 | - public function __construct( |
|
38 | + public function __construct( |
|
39 | 39 | ModuleManagerInterface $moduleManager, |
40 | 40 | $config |
41 | 41 | ) |
42 | - { |
|
43 | - $this->config = $config; |
|
44 | - $this->moduleManager = $moduleManager; |
|
45 | - } |
|
42 | + { |
|
43 | + $this->config = $config; |
|
44 | + $this->moduleManager = $moduleManager; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Home site |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | $viewModel = new ViewModel(); |
108 | 108 | $viewModel->setTemplate('error/index') |
109 | - ->setVariable('message', 'An unexpected error had occured. Please try again later.'); |
|
109 | + ->setVariable('message', 'An unexpected error had occured. Please try again later.'); |
|
110 | 110 | return $viewModel; |
111 | 111 | } |
112 | 112 | } |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class OrganizationContext implements Context |
32 | 32 | { |
33 | - use CommonContextTrait; |
|
33 | + use CommonContextTrait; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * @var JobContext |
37 | 37 | */ |
38 | - private $jobContext; |
|
38 | + private $jobContext; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * @BeforeScenario |
@@ -47,51 +47,51 @@ discard block |
||
47 | 47 | $this->jobContext = $scope->getEnvironment()->getContext(JobContext::class); |
48 | 48 | } |
49 | 49 | |
50 | - /** |
|
51 | - * @Given I go to my organization page |
|
52 | - */ |
|
53 | - public function iGoToMyOrganizationPage() |
|
54 | - { |
|
50 | + /** |
|
51 | + * @Given I go to my organization page |
|
52 | + */ |
|
53 | + public function iGoToMyOrganizationPage() |
|
54 | + { |
|
55 | 55 | $url = $this->buildUrl('lang/my-organization'); |
56 | - $this->visit($url); |
|
57 | - } |
|
56 | + $this->visit($url); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * @When I hover over name form |
|
61 | - */ |
|
62 | - public function iMouseOverOrganizationNameForm() |
|
63 | - { |
|
64 | - $locator = '#sf-nameForm .sf-summary'; |
|
65 | - $this->coreContext->iHoverOverTheElement($locator); |
|
66 | - } |
|
59 | + /** |
|
60 | + * @When I hover over name form |
|
61 | + */ |
|
62 | + public function iMouseOverOrganizationNameForm() |
|
63 | + { |
|
64 | + $locator = '#sf-nameForm .sf-summary'; |
|
65 | + $this->coreContext->iHoverOverTheElement($locator); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * @Given I go to create new organization page |
|
70 | - */ |
|
71 | - public function iGoToCreateNewOrganizationPage() |
|
72 | - { |
|
73 | - //$this->visit('/organizations/edit'); |
|
68 | + /** |
|
69 | + * @Given I go to create new organization page |
|
70 | + */ |
|
71 | + public function iGoToCreateNewOrganizationPage() |
|
72 | + { |
|
73 | + //$this->visit('/organizations/edit'); |
|
74 | 74 | $url = $this->buildUrl('lang/organizations/edit'); |
75 | 75 | $this->visit($url); |
76 | - } |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * @Given I go to organization overview page |
|
80 | - */ |
|
81 | - public function iGoToOrganizationOverviewPage() |
|
82 | - { |
|
83 | - //$this->visit('/organizations'); |
|
84 | - $url = $this->buildUrl('lang/organizations'); |
|
85 | - $this->visit($url); |
|
86 | - } |
|
78 | + /** |
|
79 | + * @Given I go to organization overview page |
|
80 | + */ |
|
81 | + public function iGoToOrganizationOverviewPage() |
|
82 | + { |
|
83 | + //$this->visit('/organizations'); |
|
84 | + $url = $this->buildUrl('lang/organizations'); |
|
85 | + $this->visit($url); |
|
86 | + } |
|
87 | 87 | |
88 | 88 | /** |
89 | 89 | * @Given I want to see list organization profiles |
90 | 90 | */ |
91 | - public function iWantToSeeListOrganizationProfiles() |
|
91 | + public function iWantToSeeListOrganizationProfiles() |
|
92 | 92 | { |
93 | - $url = $this->buildUrl('lang/organizations/profile'); |
|
94 | - $this->visit($url); |
|
93 | + $url = $this->buildUrl('lang/organizations/profile'); |
|
94 | + $this->visit($url); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @internal param string $name |
101 | 101 | * @internal param TableNode|null $table |
102 | 102 | */ |
103 | - public function iHaveOrganization($name) |
|
103 | + public function iHaveOrganization($name) |
|
104 | 104 | { |
105 | 105 | $user = $this->getUserContext()->getCurrentUser(); |
106 | 106 | $organization = $this->findOrganizationByName($name,false); |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | public function iHaveOrganization($name) |
104 | 104 | { |
105 | 105 | $user = $this->getUserContext()->getCurrentUser(); |
106 | - $organization = $this->findOrganizationByName($name,false); |
|
106 | + $organization = $this->findOrganizationByName($name, false); |
|
107 | 107 | $repo = $this->getRepository('Organizations/Organization'); |
108 | - if(!$organization instanceof Organization){ |
|
108 | + if (!$organization instanceof Organization) { |
|
109 | 109 | |
110 | 110 | $organization = new Organization(); |
111 | 111 | $organizationName = new OrganizationName($name); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $organization->setParent($parent); |
119 | 119 | $organization->setProfileSetting(Organization::PROFILE_ALWAYS_ENABLE); |
120 | 120 | $permissions = $organization->getPermissions(); |
121 | - $permissions->grant($user,Permissions::PERMISSION_ALL); |
|
121 | + $permissions->grant($user, Permissions::PERMISSION_ALL); |
|
122 | 122 | |
123 | 123 | $repo->store($organization); |
124 | 124 | $repo->getDocumentManager()->refresh($organization); |
@@ -128,19 +128,19 @@ discard block |
||
128 | 128 | /** |
129 | 129 | * @Given organization :name have jobs: |
130 | 130 | */ |
131 | - public function organizationHavePublishedJob($name,TableNode $table) |
|
131 | + public function organizationHavePublishedJob($name, TableNode $table) |
|
132 | 132 | { |
133 | 133 | $user = $this->getUserContext()->getCurrentUser(); |
134 | - if(is_null($user)){ |
|
134 | + if (is_null($user)) { |
|
135 | 135 | throw new FailedExpectationException('Need to login first'); |
136 | 136 | } |
137 | 137 | |
138 | 138 | $organization = $this->findOrganizationByName($name); |
139 | - foreach($table->getColumnsHash() as $index=>$definitions){ |
|
139 | + foreach ($table->getColumnsHash() as $index=>$definitions) { |
|
140 | 140 | $definitions['user'] = $user->getLogin(); |
141 | - $status = isset($definitions['status']) ? $definitions['status']:'draft'; |
|
141 | + $status = isset($definitions['status']) ? $definitions['status'] : 'draft'; |
|
142 | 142 | unset($definitions['status']); |
143 | - $this->jobContext->buildJob($status,$definitions,$organization); |
|
143 | + $this->jobContext->buildJob($status, $definitions, $organization); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @param $name |
150 | 150 | * @param $setting |
151 | 151 | */ |
152 | - public function profileSetting($name,$setting) |
|
152 | + public function profileSetting($name, $setting) |
|
153 | 153 | { |
154 | 154 | $repo = $this->getRepository('Organizations/Organization'); |
155 | 155 | $organization = $this->findOrganizationByName($name); |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | $contact = $organization->getContact(); |
170 | 170 | |
171 | 171 | $definitions = $table->getRowsHash(); |
172 | - foreach($definitions as $name=>$value){ |
|
172 | + foreach ($definitions as $name=>$value) { |
|
173 | 173 | $field = Inflector::camelize($name); |
174 | 174 | $method = 'set'.$field; |
175 | - $callback = array($contact,$method); |
|
176 | - if(is_callable($callback)){ |
|
177 | - call_user_func_array($callback,[$value]); |
|
175 | + $callback = array($contact, $method); |
|
176 | + if (is_callable($callback)) { |
|
177 | + call_user_func_array($callback, [$value]); |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | $this->getRepository('Organizations/Organization')->store($organization); |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | * @param string $name |
187 | 187 | * @throws FailedExpectationException |
188 | 188 | */ |
189 | - public function iGoToOrganizationProfilePage($name=null) |
|
189 | + public function iGoToOrganizationProfilePage($name = null) |
|
190 | 190 | { |
191 | - if(is_null($name)){ |
|
191 | + if (is_null($name)) { |
|
192 | 192 | $organization = $this->getUserContext()->getCurrentUser()->getOrganization()->getOrganization(); |
193 | - }else{ |
|
193 | + } else { |
|
194 | 194 | $organization = $this->findOrganizationByName($name); |
195 | 195 | } |
196 | - $url = $this->buildUrl('lang/organizations/profileDetail',[ |
|
196 | + $url = $this->buildUrl('lang/organizations/profileDetail', [ |
|
197 | 197 | 'id' => $organization->getId() |
198 | 198 | ]); |
199 | 199 | |
@@ -210,10 +210,10 @@ discard block |
||
210 | 210 | /* @var OrganizationRepository $repo */ |
211 | 211 | $repo = $this->getRepository('Organizations/Organization'); |
212 | 212 | $result = $repo->findByName($name); |
213 | - $organization = count($result) > 0 ? $result[0]:null; |
|
214 | - if(!$organization instanceof Organization && $throwException){ |
|
213 | + $organization = count($result) > 0 ? $result[0] : null; |
|
214 | + if (!$organization instanceof Organization && $throwException) { |
|
215 | 215 | throw new FailedExpectationException( |
216 | - sprintf('Organization %s is not found.',$name) |
|
216 | + sprintf('Organization %s is not found.', $name) |
|
217 | 217 | ); |
218 | 218 | } |
219 | 219 | return $organization; |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | $jobRepo = $this->getRepository('Jobs/Job'); |
233 | 233 | $result = $jobRepo->findByOrganization($org->getId()); |
234 | 234 | |
235 | - foreach($result as $job){ |
|
236 | - $jobRepo->remove($job,true); |
|
235 | + foreach ($result as $job) { |
|
236 | + $jobRepo->remove($job, true); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | { |
245 | 245 | $user = $this->getUserContext()->getCurrentUser(); |
246 | 246 | $organization = $user->getOrganization()->getOrganization(); |
247 | - $url = $this->buildUrl('lang/organizations/edit',['id' => $organization->getId()]); |
|
247 | + $url = $this->buildUrl('lang/organizations/edit', ['id' => $organization->getId()]); |
|
248 | 248 | $this->visit($url); |
249 | 249 | } |
250 | 250 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | public function iAttachLogoFromFile($file) |
256 | 256 | { |
257 | 257 | $elementId = 'organizationLogo-original'; |
258 | - $this->minkContext->attachFileToField($elementId,$file); |
|
258 | + $this->minkContext->attachFileToField($elementId, $file); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | public function iRemoveLogoFromOrganization() |
265 | 265 | { |
266 | 266 | $elementId = '#organizationLogo-original-delete'; |
267 | - $element = $this->minkContext->getSession()->getPage()->find('css',$elementId); |
|
267 | + $element = $this->minkContext->getSession()->getPage()->find('css', $elementId); |
|
268 | 268 | $element->click(); |
269 | 269 | } |
270 | 270 | } |
@@ -190,7 +190,7 @@ |
||
190 | 190 | { |
191 | 191 | if(is_null($name)){ |
192 | 192 | $organization = $this->getUserContext()->getCurrentUser()->getOrganization()->getOrganization(); |
193 | - }else{ |
|
193 | + } else{ |
|
194 | 194 | $organization = $this->findOrganizationByName($name); |
195 | 195 | } |
196 | 196 | $url = $this->buildUrl('lang/organizations/profileDetail',[ |