Completed
Push — develop ( 321e68...dce9ea )
by Carsten
09:20
created
module/Install/src/Tracy.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -26,18 +26,18 @@
 block discarded – undo
26 26
      */
27 27
     public function register(array $config)
28 28
     {
29
-    	try{
30
-		    // enable logging of all error types globally
31
-		    Debugger::enable($config['mode'], $config['log'], $config['email']);
32
-		    Debugger::$strictMode = $config['strict'];
33
-		    Debugger::$showBar = $config['bar'];
29
+        try{
30
+            // enable logging of all error types globally
31
+            Debugger::enable($config['mode'], $config['log'], $config['email']);
32
+            Debugger::$strictMode = $config['strict'];
33
+            Debugger::$showBar = $config['bar'];
34 34
 		
35
-		    /** @var \Tracy\Logger $logger */
36
-		    $logger = Debugger::getLogger();
37
-		    $logger->emailSnooze = $config['email_snooze'];
38
-	    }catch (\Exception $e){
39
-    		throw $e;
40
-	    }
35
+            /** @var \Tracy\Logger $logger */
36
+            $logger = Debugger::getLogger();
37
+            $logger->emailSnooze = $config['email_snooze'];
38
+        }catch (\Exception $e){
39
+            throw $e;
40
+        }
41 41
      
42 42
     }
43 43
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public function register(array $config)
28 28
     {
29
-    	try{
29
+    	try {
30 30
 		    // enable logging of all error types globally
31 31
 		    Debugger::enable($config['mode'], $config['log'], $config['email']);
32 32
 		    Debugger::$strictMode = $config['strict'];
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		    /** @var \Tracy\Logger $logger */
36 36
 		    $logger = Debugger::getLogger();
37 37
 		    $logger->emailSnooze = $config['email_snooze'];
38
-	    }catch (\Exception $e){
38
+	    } catch (\Exception $e) {
39 39
     		throw $e;
40 40
 	    }
41 41
      
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 		    /** @var \Tracy\Logger $logger */
36 36
 		    $logger = Debugger::getLogger();
37 37
 		    $logger->emailSnooze = $config['email_snooze'];
38
-	    }catch (\Exception $e){
38
+	    } catch (\Exception $e){
39 39
     		throw $e;
40 40
 	    }
41 41
      
Please login to merge, or discard this patch.
module/Install/src/Listener/TracyListener.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -23,31 +23,31 @@
 block discarded – undo
23 23
  */
24 24
 class TracyListener implements ListenerAggregateInterface
25 25
 {
26
-	use ListenerAggregateTrait;
26
+    use ListenerAggregateTrait;
27 27
 	
28
-	/**
29
-	 * {@inheritDoc}
30
-	 * @see \Zend\EventManager\ListenerAggregateInterface::attach()
31
-	 */
32
-	public function attach(EventManagerInterface $events, $priority = 1)
33
-	{
34
-		$this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH_ERROR, [$this, 'handleError'], $priority);
35
-		$this->listeners[] = $events->attach(MvcEvent::EVENT_RENDER_ERROR, [$this, 'handleError'], $priority);
36
-	}
28
+    /**
29
+     * {@inheritDoc}
30
+     * @see \Zend\EventManager\ListenerAggregateInterface::attach()
31
+     */
32
+    public function attach(EventManagerInterface $events, $priority = 1)
33
+    {
34
+        $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH_ERROR, [$this, 'handleError'], $priority);
35
+        $this->listeners[] = $events->attach(MvcEvent::EVENT_RENDER_ERROR, [$this, 'handleError'], $priority);
36
+    }
37 37
 	
38
-	/**
39
-	 * @param MvcEvent $e
40
-	 */
41
-	public function handleError(MvcEvent $e)
42
-	{
43
-		if ($e->getError() == \Zend\Mvc\Application::ERROR_EXCEPTION) {
44
-			if (Debugger::$productionMode) {
45
-				// log an exception in production environment (this will send email as well if email address is set)
46
-				Debugger::log($e->getParam('exception'), Debugger::ERROR);
47
-			} else {
48
-				// just re-throw an exception in non-production environment to let tracy display so called blue screen
49
-				throw $e->getParam('exception');
50
-			}
51
-		}
52
-	}
38
+    /**
39
+     * @param MvcEvent $e
40
+     */
41
+    public function handleError(MvcEvent $e)
42
+    {
43
+        if ($e->getError() == \Zend\Mvc\Application::ERROR_EXCEPTION) {
44
+            if (Debugger::$productionMode) {
45
+                // log an exception in production environment (this will send email as well if email address is set)
46
+                Debugger::log($e->getParam('exception'), Debugger::ERROR);
47
+            } else {
48
+                // just re-throw an exception in non-production environment to let tracy display so called blue screen
49
+                throw $e->getParam('exception');
50
+            }
51
+        }
52
+    }
53 53
 }
Please login to merge, or discard this patch.
module/Install/src/Factory/Controller/LazyControllerFactory.php 3 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -22,55 +22,55 @@
 block discarded – undo
22 22
  */
23 23
 class LazyControllerFactory implements AbstractFactoryInterface
24 24
 {
25
-	protected $aliases = [
26
-		FormElementManager::class => 'FormElementManager',
27
-		ValidatorPluginManager::class => 'ValidatorManager',
28
-		Translator::class => 'translator',
29
-	];
25
+    protected $aliases = [
26
+        FormElementManager::class => 'FormElementManager',
27
+        ValidatorPluginManager::class => 'ValidatorManager',
28
+        Translator::class => 'translator',
29
+    ];
30 30
 	
31
-	public function canCreate( ContainerInterface $container, $requestedName )
32
-	{
33
-		list( $module, ) = explode( '\\', __NAMESPACE__, 2 );
34
-		return strstr( $requestedName, $module . '\Controller') !== false;
35
-	}
31
+    public function canCreate( ContainerInterface $container, $requestedName )
32
+    {
33
+        list( $module, ) = explode( '\\', __NAMESPACE__, 2 );
34
+        return strstr( $requestedName, $module . '\Controller') !== false;
35
+    }
36 36
 	
37
-	public function __invoke( ContainerInterface $container, $requestedName, array $options = null )
38
-	{
39
-		$class = new \ReflectionClass($requestedName);
40
-		$parentLocator = $container;
41
-		if( $constructor = $class->getConstructor() )
42
-		{
43
-			if( $params = $constructor->getParameters() )
44
-			{
45
-				$parameter_instances = [];
46
-				foreach( $params as $p )
47
-				{
37
+    public function __invoke( ContainerInterface $container, $requestedName, array $options = null )
38
+    {
39
+        $class = new \ReflectionClass($requestedName);
40
+        $parentLocator = $container;
41
+        if( $constructor = $class->getConstructor() )
42
+        {
43
+            if( $params = $constructor->getParameters() )
44
+            {
45
+                $parameter_instances = [];
46
+                foreach( $params as $p )
47
+                {
48 48
 					
49
-					if( $p->getClass() ) {
50
-						$cn = $p->getClass()->getName();
51
-						if (array_key_exists($cn, $this->aliases)) {
52
-							$cn = $this->aliases[$cn];
53
-						}
49
+                    if( $p->getClass() ) {
50
+                        $cn = $p->getClass()->getName();
51
+                        if (array_key_exists($cn, $this->aliases)) {
52
+                            $cn = $this->aliases[$cn];
53
+                        }
54 54
 						
55
-						try {
56
-							$parameter_instances[] = $parentLocator->get($cn);
57
-						}
58
-						catch (\Exception $x) {
59
-							echo __CLASS__
60
-							     . " couldn't create an instance of $cn to satisfy the constructor for $requestedName.";
61
-							exit;
62
-						}
63
-					}
64
-					else{
65
-						if( $p->isArray() && $p->getName() == 'config' )
66
-							$parameter_instances[] = $parentLocator->get('config');
67
-					}
55
+                        try {
56
+                            $parameter_instances[] = $parentLocator->get($cn);
57
+                        }
58
+                        catch (\Exception $x) {
59
+                            echo __CLASS__
60
+                                    . " couldn't create an instance of $cn to satisfy the constructor for $requestedName.";
61
+                            exit;
62
+                        }
63
+                    }
64
+                    else{
65
+                        if( $p->isArray() && $p->getName() == 'config' )
66
+                            $parameter_instances[] = $parentLocator->get('config');
67
+                    }
68 68
 					
69
-				}
70
-				return $class->newInstanceArgs($parameter_instances);
71
-			}
72
-		}
69
+                }
70
+                return $class->newInstanceArgs($parameter_instances);
71
+            }
72
+        }
73 73
 		
74
-		return new $requestedName;
75
-	}
74
+        return new $requestedName;
75
+    }
76 76
 }
77 77
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,25 +28,25 @@  discard block
 block discarded – undo
28 28
 		Translator::class => 'translator',
29 29
 	];
30 30
 	
31
-	public function canCreate( ContainerInterface $container, $requestedName )
31
+	public function canCreate(ContainerInterface $container, $requestedName)
32 32
 	{
33
-		list( $module, ) = explode( '\\', __NAMESPACE__, 2 );
34
-		return strstr( $requestedName, $module . '\Controller') !== false;
33
+		list($module,) = explode('\\', __NAMESPACE__, 2);
34
+		return strstr($requestedName, $module.'\Controller') !== false;
35 35
 	}
36 36
 	
37
-	public function __invoke( ContainerInterface $container, $requestedName, array $options = null )
37
+	public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
38 38
 	{
39 39
 		$class = new \ReflectionClass($requestedName);
40 40
 		$parentLocator = $container;
41
-		if( $constructor = $class->getConstructor() )
41
+		if ($constructor = $class->getConstructor())
42 42
 		{
43
-			if( $params = $constructor->getParameters() )
43
+			if ($params = $constructor->getParameters())
44 44
 			{
45 45
 				$parameter_instances = [];
46
-				foreach( $params as $p )
46
+				foreach ($params as $p)
47 47
 				{
48 48
 					
49
-					if( $p->getClass() ) {
49
+					if ($p->getClass()) {
50 50
 						$cn = $p->getClass()->getName();
51 51
 						if (array_key_exists($cn, $this->aliases)) {
52 52
 							$cn = $this->aliases[$cn];
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 							exit;
62 62
 						}
63 63
 					}
64
-					else{
65
-						if( $p->isArray() && $p->getName() == 'config' )
64
+					else {
65
+						if ($p->isArray() && $p->getName() == 'config')
66 66
 							$parameter_instances[] = $parentLocator->get('config');
67 67
 					}
68 68
 					
Please login to merge, or discard this patch.
Braces   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,16 +54,15 @@
 block discarded – undo
54 54
 						
55 55
 						try {
56 56
 							$parameter_instances[] = $parentLocator->get($cn);
57
-						}
58
-						catch (\Exception $x) {
57
+						} catch (\Exception $x) {
59 58
 							echo __CLASS__
60 59
 							     . " couldn't create an instance of $cn to satisfy the constructor for $requestedName.";
61 60
 							exit;
62 61
 						}
63
-					}
64
-					else{
65
-						if( $p->isArray() && $p->getName() == 'config' )
66
-							$parameter_instances[] = $parentLocator->get('config');
62
+					} else{
63
+						if( $p->isArray() && $p->getName() == 'config' ) {
64
+													$parameter_instances[] = $parentLocator->get('config');
65
+						}
67 66
 					}
68 67
 					
69 68
 				}
Please login to merge, or discard this patch.
module/Install/src/Controller/Index.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
  */
27 27
 class Index extends AbstractActionController
28 28
 {
29
-	protected $installForm;
29
+    protected $installForm;
30 30
 	
31
-	public function __construct(FormElementManager $formElementManager)
32
-	{
33
-		$this->installForm = $formElementManager->get('Install/Installation');
34
-	}
31
+    public function __construct(FormElementManager $formElementManager)
32
+    {
33
+        $this->installForm = $formElementManager->get('Install/Installation');
34
+    }
35 35
 	
36
-	/**
36
+    /**
37 37
      * Hook for custom preDispatch event.
38 38
      *
39 39
      * @param MvcEvent $event
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
             $routeMatch->setParam('action', $p);
51 51
             $response = $this->getResponse();
52 52
             $response->getHeaders()
53
-                     ->addHeaderLine('Content-Type', 'application/json')
54
-                     ->addHeaderLine('Content-Encoding', 'utf8');
53
+                        ->addHeaderLine('Content-Type', 'application/json')
54
+                        ->addHeaderLine('Content-Encoding', 'utf8');
55 55
         }
56 56
     }
57 57
 
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
         $form    = $this->installForm;
66 66
         $prereqs = $this->plugin('Install/Prerequisites')->check();
67 67
 	
68
-	    return $this->createViewModel(
69
-		    array(
70
-			    'prerequisites' => $prereqs,
71
-			    'form'          => $form,
72
-			    'lang'          => $this->params('lang'),
73
-		    )
74
-	    );
68
+        return $this->createViewModel(
69
+            array(
70
+                'prerequisites' => $prereqs,
71
+                'form'          => $form,
72
+                'lang'          => $this->params('lang'),
73
+            )
74
+        );
75 75
     }
76 76
 
77 77
     /**
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
         $form->setData($_POST);
101 101
 
102 102
         if (!$form->isValid()) {
103
-	        return $this->createJsonResponse(
104
-		        array(
105
-			        'ok'     => false,
106
-			        'errors' => $form->getMessages(),
107
-		        )
108
-	        );
103
+            return $this->createJsonResponse(
104
+                array(
105
+                    'ok'     => false,
106
+                    'errors' => $form->getMessages(),
107
+                )
108
+            );
109 109
         }
110 110
 
111 111
         $data = $form->getData();
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
      */
134 134
     protected function attachDefaultListeners()
135 135
     {
136
-	    parent::attachDefaultListeners();
136
+        parent::attachDefaultListeners();
137 137
 	
138
-	    $events = $this->getEventManager();
139
-	    $events->attach( MvcEvent::EVENT_DISPATCH, array( $this, 'preDispatch' ), 100 );
138
+        $events = $this->getEventManager();
139
+        $events->attach( MvcEvent::EVENT_DISPATCH, array( $this, 'preDispatch' ), 100 );
140 140
     }
141 141
 
142 142
     /**
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@
 block discarded – undo
136 136
 	    parent::attachDefaultListeners();
137 137
 	
138 138
 	    $events = $this->getEventManager();
139
-	    $events->attach( MvcEvent::EVENT_DISPATCH, array( $this, 'preDispatch' ), 100 );
139
+	    $events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'preDispatch'), 100);
140 140
     }
141 141
 
142 142
     /**
Please login to merge, or discard this patch.
module/Install/src/Form/Installation.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -26,57 +26,57 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function init()
28 28
     {
29
-	    $this->setName('installation');
29
+        $this->setName('installation');
30 30
 	
31
-	    $this->setAttributes(
32
-		    array(
33
-			    'method' => 'post',
34
-		    )
35
-	    );
31
+        $this->setAttributes(
32
+            array(
33
+                'method' => 'post',
34
+            )
35
+        );
36 36
 	
37
-	    $this->add(
38
-		    array(
39
-			    'type'       => 'Text',
40
-			    'name'       => 'db_conn',
41
-			    'options'    => array(
42
-				    'label' => /* @translate */ 'Database connection string',
43
-			    ),
44
-			    'attributes' => array(
45
-				    'placeholder' => 'mongodb://localhost:27017/YAWIK',
46
-			    ),
37
+        $this->add(
38
+            array(
39
+                'type'       => 'Text',
40
+                'name'       => 'db_conn',
41
+                'options'    => array(
42
+                    'label' => /* @translate */ 'Database connection string',
43
+                ),
44
+                'attributes' => array(
45
+                    'placeholder' => 'mongodb://localhost:27017/YAWIK',
46
+                ),
47 47
 		
48
-		    )
49
-	    );
48
+            )
49
+        );
50 50
 	
51
-	    $this->add(
52
-		    array(
53
-			    'type'    => 'Text',
54
-			    'name'    => 'username',
55
-			    'options' => array(
56
-				    'label' => /* @translate */ 'Initial user name',
57
-			    ),
58
-		    )
59
-	    );
51
+        $this->add(
52
+            array(
53
+                'type'    => 'Text',
54
+                'name'    => 'username',
55
+                'options' => array(
56
+                    'label' => /* @translate */ 'Initial user name',
57
+                ),
58
+            )
59
+        );
60 60
 	
61
-	    $this->add(
62
-		    array(
63
-			    'type'    => 'Password',
64
-			    'name'    => 'password',
65
-			    'options' => array(
66
-				    'label' => /* @translate */ 'Password',
67
-			    ),
68
-		    )
69
-	    );
61
+        $this->add(
62
+            array(
63
+                'type'    => 'Password',
64
+                'name'    => 'password',
65
+                'options' => array(
66
+                    'label' => /* @translate */ 'Password',
67
+                ),
68
+            )
69
+        );
70 70
 	
71
-	    $this->add(
72
-		    array(
73
-			    'type' => 'Text',
74
-			    'name' => 'email',
75
-			    'options' => array(
76
-				    'label' => /* @translate */ 'Email address for system messages',
77
-			    ),
78
-		    )
79
-	    );
71
+        $this->add(
72
+            array(
73
+                'type' => 'Text',
74
+                'name' => 'email',
75
+                'options' => array(
76
+                    'label' => /* @translate */ 'Email address for system messages',
77
+                ),
78
+            )
79
+        );
80 80
     }
81 81
 
82 82
     public function getInputFilterSpecification()
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
                 ),
91 91
                 'validators'        => array(
92 92
                     array('name' => MongoDbConnectionString::class,
93
-                          'break_chain_on_failure' => true),
93
+                            'break_chain_on_failure' => true),
94 94
                     array('name' => MongoDbConnection::class),
95 95
                 ),
96 96
             ),
Please login to merge, or discard this patch.
module/Behat/src/CvContext.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -22,22 +22,22 @@
 block discarded – undo
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
-		$this->visit('/en/my/cv');
34
-	}
28
+    /**
29
+     * @Given I go to manage my resume page
30
+     */
31
+    public function iGoToManageResumePage()
32
+    {
33
+        $this->visit('/en/my/cv');
34
+    }
35 35
 	
36
-	/**
37
-	 * @When I click edit on my personal information
38
-	 */
39
-	public function iClickEditOnPersonalInformations()
40
-	{
41
-		$this->summaryFormContext->iClickEditOnForm('resumePersonalInformations');
42
-	}
36
+    /**
37
+     * @When I click edit on my personal information
38
+     */
39
+    public function iClickEditOnPersonalInformations()
40
+    {
41
+        $this->summaryFormContext->iClickEditOnForm('resumePersonalInformations');
42
+    }
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
module/Behat/src/OrganizationContext.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -23,39 +23,39 @@
 block discarded – undo
23 23
  */
24 24
 class OrganizationContext implements Context
25 25
 {
26
-	use CommonContextTrait;
26
+    use CommonContextTrait;
27 27
 	
28
-	/**
29
-	 * @Given I go to my organization page
30
-	 */
31
-	public function iGoToMyOrganizationPage()
32
-	{
33
-		$url = $this->coreContext->generateUrl('/en/my/organization');
34
-		$this->coreContext->iVisit($url);
35
-	}
28
+    /**
29
+     * @Given I go to my organization page
30
+     */
31
+    public function iGoToMyOrganizationPage()
32
+    {
33
+        $url = $this->coreContext->generateUrl('/en/my/organization');
34
+        $this->coreContext->iVisit($url);
35
+    }
36 36
 	
37
-	/**
38
-	 * @When I hover over name form
39
-	 */
40
-	public function iMouseOverOrganizationNameForm()
41
-	{
42
-		$locator = '#sf-nameForm .sf-summary';
43
-		$this->coreContext->iHoverOverTheElement($locator);
44
-	}
37
+    /**
38
+     * @When I hover over name form
39
+     */
40
+    public function iMouseOverOrganizationNameForm()
41
+    {
42
+        $locator = '#sf-nameForm .sf-summary';
43
+        $this->coreContext->iHoverOverTheElement($locator);
44
+    }
45 45
 	
46
-	/**
47
-	 * @Given I go to create new organization page
48
-	 */
49
-	public function iGoToCreateNewOrganizationPage()
50
-	{
51
-		$this->visit('/en/organizations/edit');
52
-	}
46
+    /**
47
+     * @Given I go to create new organization page
48
+     */
49
+    public function iGoToCreateNewOrganizationPage()
50
+    {
51
+        $this->visit('/en/organizations/edit');
52
+    }
53 53
 	
54
-	/**
55
-	 * @Given I go to organization overview page
56
-	 */
57
-	public function iGoToOrganizationOverviewPage()
58
-	{
59
-		$this->visit('/en/organizations');
60
-	}
54
+    /**
55
+     * @Given I go to organization overview page
56
+     */
57
+    public function iGoToOrganizationOverviewPage()
58
+    {
59
+        $this->visit('/en/organizations');
60
+    }
61 61
 }
62 62
\ No newline at end of file
Please login to merge, or discard this patch.
module/Behat/src/SettingsContext.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@
 block discarded – undo
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('/en/settings');
25
-	}
19
+    /**
20
+     * @Given I go to settings page
21
+     */
22
+    public function iGoToSettingsPage()
23
+    {
24
+        $this->visit('/en/settings');
25
+    }
26 26
 	
27
-	/**
28
-	 * @Given I go to email template settings page
29
-	 */
30
-	public function iGoToEmailTemplatePage()
31
-	{
32
-		$this->visit('/en/settings/Applications');
33
-	}
27
+    /**
28
+     * @Given I go to email template settings page
29
+     */
30
+    public function iGoToEmailTemplatePage()
31
+    {
32
+        $this->visit('/en/settings/Applications');
33
+    }
34 34
 }
35 35
\ No newline at end of file
Please login to merge, or discard this patch.
module/Behat/src/JobContext.php 3 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 		$element = $page->find('css',$mapMultiple[$field]);
180 180
 		if(!is_null($element) && $element->getAttribute('multiple')=='multiple'){
181 181
 			$this->minkContext->selectOption($value,$multipleField);
182
-		}else{
182
+		} else{
183 183
 			$locator = $mapSelect2[$field];
184 184
 			$this->select2Context->iFillInSelect2Field($locator,$value);
185 185
 		}
@@ -230,14 +230,14 @@  discard block
 block discarded – undo
230 230
 			if($user instanceof User){
231 231
 				$job->setUser($user);
232 232
 				$job->setOrganization($user->getOrganization()->getOrganization());
233
-			}else{
233
+			} else{
234 234
 				throw new \Exception('There is no user with this login:"'.$normalizedField['user'.'"']);
235 235
 			}
236 236
 		}
237 237
 		
238 238
 		if($status == 'draft'){
239 239
 			$job->setIsDraft(true);
240
-		}elseif($status == 'published'){
240
+		} elseif($status == 'published'){
241 241
 			$job->setIsDraft(false);
242 242
 			$job->setDatePublishStart(new \DateTime());
243 243
 		}
Please login to merge, or discard this patch.
Indentation   +282 added lines, -282 removed lines patch added patch discarded remove patch
@@ -33,320 +33,320 @@
 block discarded – undo
33 33
  */
34 34
 class JobContext implements Context
35 35
 {
36
-	use CommonContextTrait;
36
+    use CommonContextTrait;
37 37
 	
38
-	/**
39
-	 * @var Select2Context
40
-	 */
41
-	private $select2Context;
38
+    /**
39
+     * @var Select2Context
40
+     */
41
+    private $select2Context;
42 42
 	
43
-	/**
44
-	 * @var Job
45
-	 */
46
-	private $currentJob;
43
+    /**
44
+     * @var Job
45
+     */
46
+    private $currentJob;
47 47
 	
48
-	/**
49
-	 * @var JobRepository
50
-	 */
51
-	static private $jobRepo;
48
+    /**
49
+     * @var JobRepository
50
+     */
51
+    static private $jobRepo;
52 52
 	
53
-	/**
54
-	 * @param User $user
55
-	 */
56
-	static public function removeJobByUser(User $user)
57
-	{
58
-		$repo = static::$jobRepo;
59
-		$results = $repo->findBy(['user' => $user]);
60
-		foreach($results as $result){
61
-			$repo->remove($result,true);
62
-		}
63
-	}
53
+    /**
54
+     * @param User $user
55
+     */
56
+    static public function removeJobByUser(User $user)
57
+    {
58
+        $repo = static::$jobRepo;
59
+        $results = $repo->findBy(['user' => $user]);
60
+        foreach($results as $result){
61
+            $repo->remove($result,true);
62
+        }
63
+    }
64 64
 	
65
-	/**
66
-	 * @BeforeScenario
67
-	 *
68
-	 * @param BeforeScenarioScope $scope
69
-	 */
70
-	public function beforeScenario(BeforeScenarioScope $scope)
71
-	{
72
-		$this->select2Context = $scope->getEnvironment()->getContext(Select2Context::class);
73
-		if(is_null(static::$jobRepo)){
74
-			$this->gatherContexts($scope);
75
-			static::$jobRepo = $this->getJobRepository();
76
-		}
77
-	}
65
+    /**
66
+     * @BeforeScenario
67
+     *
68
+     * @param BeforeScenarioScope $scope
69
+     */
70
+    public function beforeScenario(BeforeScenarioScope $scope)
71
+    {
72
+        $this->select2Context = $scope->getEnvironment()->getContext(Select2Context::class);
73
+        if(is_null(static::$jobRepo)){
74
+            $this->gatherContexts($scope);
75
+            static::$jobRepo = $this->getJobRepository();
76
+        }
77
+    }
78 78
 	
79
-	/**
80
-	 * @Given I go to job board page
81
-	 */
82
-	public function iGoToJobBoardPage()
83
-	{
84
-		$this->visit('/en/jobboard');
85
-	}
79
+    /**
80
+     * @Given I go to job board page
81
+     */
82
+    public function iGoToJobBoardPage()
83
+    {
84
+        $this->visit('/en/jobboard');
85
+    }
86 86
 	
87
-	/**
88
-	 * @Given I go to create job page
89
-	 */
90
-	public function iGoToMyOrganizationPage()
91
-	{
92
-		$this->visit('/en/jobs/edit');
93
-	}
87
+    /**
88
+     * @Given I go to create job page
89
+     */
90
+    public function iGoToMyOrganizationPage()
91
+    {
92
+        $this->visit('/en/jobs/edit');
93
+    }
94 94
 	
95
-	/**
96
-	 * @Given I go to job overview page
97
-	 */
98
-	public function iGoToJobOverviewPage()
99
-	{
100
-		$this->visit('/en/jobs');
101
-	}
95
+    /**
96
+     * @Given I go to job overview page
97
+     */
98
+    public function iGoToJobOverviewPage()
99
+    {
100
+        $this->visit('/en/jobs');
101
+    }
102 102
 	
103
-	/**
104
-	 * @Given I go to edit job draft with title :jobTitle
105
-	 * @param $jobTitle
106
-	 * @throws \Exception when job is not found
107
-	 */
108
-	public function iGoToEditJobWithTitle($jobTitle)
109
-	{
110
-		$job = $this->getJobRepository()->findOneBy(['title' => $jobTitle]);
111
-		if(!$job instanceof Job){
112
-			throw new \Exception(sprintf('Job with title "%s" is not found',$jobTitle));
113
-		}
114
-		$this->currentJob = $job;
115
-		$url = '/en/jobs/edit?id='.$job->getId();
116
-		$this->visit($url);
117
-	}
103
+    /**
104
+     * @Given I go to edit job draft with title :jobTitle
105
+     * @param $jobTitle
106
+     * @throws \Exception when job is not found
107
+     */
108
+    public function iGoToEditJobWithTitle($jobTitle)
109
+    {
110
+        $job = $this->getJobRepository()->findOneBy(['title' => $jobTitle]);
111
+        if(!$job instanceof Job){
112
+            throw new \Exception(sprintf('Job with title "%s" is not found',$jobTitle));
113
+        }
114
+        $this->currentJob = $job;
115
+        $url = '/en/jobs/edit?id='.$job->getId();
116
+        $this->visit($url);
117
+    }
118 118
 	
119
-	/**
120
-	 * @Given I don't have any classification data
121
-	 */
122
-	public function iDonTHaveAnyClassificationData()
123
-	{
124
-		$this->currentJob->setClassifications(new Classifications());
125
-		$this->getJobRepository()->store($this->currentJob);
126
-	}
119
+    /**
120
+     * @Given I don't have any classification data
121
+     */
122
+    public function iDonTHaveAnyClassificationData()
123
+    {
124
+        $this->currentJob->setClassifications(new Classifications());
125
+        $this->getJobRepository()->store($this->currentJob);
126
+    }
127 127
 	
128
-	/**
129
-	 * @When I don't have any posted job
130
-	 */
131
-	public function iDonTHaveAnyPostedJob()
132
-	{
133
-		/* @var $jobRepository JobRepository */
134
-		/* @var $job Job */
135
-		$user = $this->getCurrentUser();
136
-		$jobRepository = $this->getJobRepository();
137
-		$results = $jobRepository->getUserJobs($user->getId());
138
-		foreach($results as $job){
139
-			$jobRepository->remove($job,true);
140
-		}
141
-		$this->currentJob = null;
142
-	}
128
+    /**
129
+     * @When I don't have any posted job
130
+     */
131
+    public function iDonTHaveAnyPostedJob()
132
+    {
133
+        /* @var $jobRepository JobRepository */
134
+        /* @var $job Job */
135
+        $user = $this->getCurrentUser();
136
+        $jobRepository = $this->getJobRepository();
137
+        $results = $jobRepository->getUserJobs($user->getId());
138
+        foreach($results as $job){
139
+            $jobRepository->remove($job,true);
140
+        }
141
+        $this->currentJob = null;
142
+    }
143 143
 	
144
-	/**
145
-	 * @When I fill job location search with :search and choose :choice
146
-	 *
147
-	 */
148
-	public function iFillJobLocationAndChoose($search,$choice)
149
-	{
150
-		$select2 = $this->select2Context;
151
-		$select2->iFillInSelect2FieldWith('jobBase[geoLocation]',$search,$choice);
152
-	}
144
+    /**
145
+     * @When I fill job location search with :search and choose :choice
146
+     *
147
+     */
148
+    public function iFillJobLocationAndChoose($search,$choice)
149
+    {
150
+        $select2 = $this->select2Context;
151
+        $select2->iFillInSelect2FieldWith('jobBase[geoLocation]',$search,$choice);
152
+    }
153 153
 	
154
-	/**
155
-	 * @When I choose :value from :field
156
-	 */
157
-	public function iJobClassificationSelect($value,$field)
158
-	{
159
-		$field = Inflector::camelize($field);
154
+    /**
155
+     * @When I choose :value from :field
156
+     */
157
+    public function iJobClassificationSelect($value,$field)
158
+    {
159
+        $field = Inflector::camelize($field);
160 160
 		
161
-		$mapSelect2 = [
162
-			'professions' => '#classifications-professions-span .select2-container',
163
-			'industries'  => '#classifications-industries-span .select2-container',
164
-			'employmentTypes' => '#classifications-employmentTypes-span .select2-container',
165
-		];
161
+        $mapSelect2 = [
162
+            'professions' => '#classifications-professions-span .select2-container',
163
+            'industries'  => '#classifications-industries-span .select2-container',
164
+            'employmentTypes' => '#classifications-employmentTypes-span .select2-container',
165
+        ];
166 166
 		
167
-		$mapMultiple = [
168
-			'professions'       => "select#classifications-professions",
169
-			'industries'        => "select#classifications-industries",
170
-			'employmentTypes'    => "select#classifications-employmentTypes",
171
-		];
167
+        $mapMultiple = [
168
+            'professions'       => "select#classifications-professions",
169
+            'industries'        => "select#classifications-industries",
170
+            'employmentTypes'    => "select#classifications-employmentTypes",
171
+        ];
172 172
 		
173
-		if(!isset($mapSelect2[$field])){
174
-			throw new \Exception('Undefined field selection value "'.$field.'"');
175
-		}
173
+        if(!isset($mapSelect2[$field])){
174
+            throw new \Exception('Undefined field selection value "'.$field.'"');
175
+        }
176 176
 		
177
-		$multipleField = $mapMultiple[$field];
178
-		$page = $this->minkContext->getSession()->getPage();
179
-		$element = $page->find('css',$mapMultiple[$field]);
180
-		if(!is_null($element) && $element->getAttribute('multiple')=='multiple'){
181
-			$this->minkContext->selectOption($value,$multipleField);
182
-		}else{
183
-			$locator = $mapSelect2[$field];
184
-			$this->select2Context->iFillInSelect2Field($locator,$value);
185
-		}
186
-	}
177
+        $multipleField = $mapMultiple[$field];
178
+        $page = $this->minkContext->getSession()->getPage();
179
+        $element = $page->find('css',$mapMultiple[$field]);
180
+        if(!is_null($element) && $element->getAttribute('multiple')=='multiple'){
181
+            $this->minkContext->selectOption($value,$multipleField);
182
+        }else{
183
+            $locator = $mapSelect2[$field];
184
+            $this->select2Context->iFillInSelect2Field($locator,$value);
185
+        }
186
+    }
187 187
 	
188
-	/**
189
-	 * @return JobRepository
190
-	 */
191
-	public function getJobRepository()
192
-	{
193
-		return $this->getRepository('Jobs/Job');
194
-	}
188
+    /**
189
+     * @return JobRepository
190
+     */
191
+    public function getJobRepository()
192
+    {
193
+        return $this->getRepository('Jobs/Job');
194
+    }
195 195
 	
196
-	/**
197
-	 * @return CategoriesRepo
198
-	 */
199
-	public function getCategoriesRepository()
200
-	{
201
-		return $this->getRepository('Jobs/Category');
202
-	}
196
+    /**
197
+     * @return CategoriesRepo
198
+     */
199
+    public function getCategoriesRepository()
200
+    {
201
+        return $this->getRepository('Jobs/Category');
202
+    }
203 203
 	
204
-	/**
205
-	 * @When I have a :status job with the following:
206
-	 * @param TableNode $fields
207
-	 */
208
-	public function iHaveAJobWithTheFollowing($status,TableNode $fields)
209
-	{
210
-		$normalizedField = [
211
-			'template' => 'modern',
212
-		];
213
-		foreach($fields->getRowsHash() as $field => $value){
214
-			$field = Inflector::camelize($field);
215
-			if($field == 'professions' || $field == 'industries'){
216
-				$value = explode(',',$value);
217
-			}
218
-			$normalizedField[$field] = $value;
219
-		}
220
-		$jobRepo = $this->getJobRepository();
221
-		$job = $jobRepo->findOneBy(['title' => $normalizedField['title']]);
222
-		if(!$job instanceof Job){
223
-			$job = new Job();
224
-			$job->setTitle($normalizedField['title']);
225
-		}
226
-		if(isset($normalizedField['user'])){
227
-			/* @var $userRepo UserRepository */
228
-			$userRepo = $this->getRepository('Auth\Entity\User');
229
-			$user = $userRepo->findOneBy(['login' => $normalizedField['user']]);
230
-			if($user instanceof User){
231
-				$job->setUser($user);
232
-				$job->setOrganization($user->getOrganization()->getOrganization());
233
-			}else{
234
-				throw new \Exception('There is no user with this login:"'.$normalizedField['user'.'"']);
235
-			}
236
-		}
204
+    /**
205
+     * @When I have a :status job with the following:
206
+     * @param TableNode $fields
207
+     */
208
+    public function iHaveAJobWithTheFollowing($status,TableNode $fields)
209
+    {
210
+        $normalizedField = [
211
+            'template' => 'modern',
212
+        ];
213
+        foreach($fields->getRowsHash() as $field => $value){
214
+            $field = Inflector::camelize($field);
215
+            if($field == 'professions' || $field == 'industries'){
216
+                $value = explode(',',$value);
217
+            }
218
+            $normalizedField[$field] = $value;
219
+        }
220
+        $jobRepo = $this->getJobRepository();
221
+        $job = $jobRepo->findOneBy(['title' => $normalizedField['title']]);
222
+        if(!$job instanceof Job){
223
+            $job = new Job();
224
+            $job->setTitle($normalizedField['title']);
225
+        }
226
+        if(isset($normalizedField['user'])){
227
+            /* @var $userRepo UserRepository */
228
+            $userRepo = $this->getRepository('Auth\Entity\User');
229
+            $user = $userRepo->findOneBy(['login' => $normalizedField['user']]);
230
+            if($user instanceof User){
231
+                $job->setUser($user);
232
+                $job->setOrganization($user->getOrganization()->getOrganization());
233
+            }else{
234
+                throw new \Exception('There is no user with this login:"'.$normalizedField['user'.'"']);
235
+            }
236
+        }
237 237
 		
238
-		if($status == 'draft'){
239
-			$job->setIsDraft(true);
240
-		}elseif($status == 'published'){
241
-			$job->setIsDraft(false);
242
-			$job->setDatePublishStart(new \DateTime());
243
-		}
244
-		$job->setStatus(Status::ACTIVE);
238
+        if($status == 'draft'){
239
+            $job->setIsDraft(true);
240
+        }elseif($status == 'published'){
241
+            $job->setIsDraft(false);
242
+            $job->setDatePublishStart(new \DateTime());
243
+        }
244
+        $job->setStatus(Status::ACTIVE);
245 245
 		
246
-		if(isset($normalizedField['location'])){
247
-			$this->setLocation($job,$normalizedField['location']);
248
-		}
249
-		if(isset($normalizedField['companyName'])){
250
-			//$job->setCompany($normalizedField['companyName']);
251
-		}
252
-		if(isset($normalizedField['professions'])){
253
-			$this->addProfessions($job,$normalizedField['professions']);
254
-		}
246
+        if(isset($normalizedField['location'])){
247
+            $this->setLocation($job,$normalizedField['location']);
248
+        }
249
+        if(isset($normalizedField['companyName'])){
250
+            //$job->setCompany($normalizedField['companyName']);
251
+        }
252
+        if(isset($normalizedField['professions'])){
253
+            $this->addProfessions($job,$normalizedField['professions']);
254
+        }
255 255
 		
256
-		if(isset($normalizedField['industries'])){
257
-			$this->addIndustries($job,$normalizedField['industries']);
258
-		}
259
-		if(isset($normalizedField['employmentTypes'])){
260
-			$types = $this->getCategories([$normalizedField['employmentTypes']]);
261
-			$type = array_shift($types);
262
-			$values = $job->getClassifications()->getEmploymentTypes()->getValues();
263
-			if(!is_array($values) || !in_array($type,$values)){
264
-				$job->getClassifications()->getEmploymentTypes()->getItems()->add($type);
265
-			}
266
-		}
256
+        if(isset($normalizedField['industries'])){
257
+            $this->addIndustries($job,$normalizedField['industries']);
258
+        }
259
+        if(isset($normalizedField['employmentTypes'])){
260
+            $types = $this->getCategories([$normalizedField['employmentTypes']]);
261
+            $type = array_shift($types);
262
+            $values = $job->getClassifications()->getEmploymentTypes()->getValues();
263
+            if(!is_array($values) || !in_array($type,$values)){
264
+                $job->getClassifications()->getEmploymentTypes()->getItems()->add($type);
265
+            }
266
+        }
267 267
 		
268
-		$jobRepo->store($job);
269
-		$this->currentJob = $job;
270
-	}
268
+        $jobRepo->store($job);
269
+        $this->currentJob = $job;
270
+    }
271 271
 	
272
-	private function setLocation(Job $job, $term)
273
-	{
274
-		/* @var $client Photon */
275
-		$client = $this->coreContext->getServiceManager()->get('Geo/Client');
276
-		$result = $client->queryOne($term);
277
-		$location = new Location();
278
-		$serialized = Json::encode($result);
279
-		$location->fromString($serialized);
272
+    private function setLocation(Job $job, $term)
273
+    {
274
+        /* @var $client Photon */
275
+        $client = $this->coreContext->getServiceManager()->get('Geo/Client');
276
+        $result = $client->queryOne($term);
277
+        $location = new Location();
278
+        $serialized = Json::encode($result);
279
+        $location->fromString($serialized);
280 280
 		
281
-		$locations = $job->getLocations();
282
-		if(count($locations)){
283
-			$locations->clear();
284
-		}
285
-		$job->getLocations()->add($location);
286
-	}
281
+        $locations = $job->getLocations();
282
+        if(count($locations)){
283
+            $locations->clear();
284
+        }
285
+        $job->getLocations()->add($location);
286
+    }
287 287
 	
288
-	private function addProfessions(Job &$job,$terms)
289
-	{
290
-		$professions = $this->getCategories($terms);
291
-		foreach($professions as $profession){
292
-			$values = $job->getClassifications()->getProfessions()->getValues();
293
-			if(!is_array($values) || !in_array($profession,$values)){
294
-				$job->getClassifications()->getProfessions()->getItems()->add($profession);
295
-			}
296
-		}
297
-	}
288
+    private function addProfessions(Job &$job,$terms)
289
+    {
290
+        $professions = $this->getCategories($terms);
291
+        foreach($professions as $profession){
292
+            $values = $job->getClassifications()->getProfessions()->getValues();
293
+            if(!is_array($values) || !in_array($profession,$values)){
294
+                $job->getClassifications()->getProfessions()->getItems()->add($profession);
295
+            }
296
+        }
297
+    }
298 298
 	
299
-	private function addIndustries(Job &$job, $terms)
300
-	{
301
-		$industries = $this->getCategories($terms);
302
-		foreach($industries as $industry){
303
-			$values = $job->getClassifications()->getIndustries()->getValues();
304
-			if(!is_array($values) || !in_array($industry,$values)){
305
-				$job->getClassifications()->getIndustries()->getItems()->add($industry);
306
-			}
307
-		}
308
-	}
299
+    private function addIndustries(Job &$job, $terms)
300
+    {
301
+        $industries = $this->getCategories($terms);
302
+        foreach($industries as $industry){
303
+            $values = $job->getClassifications()->getIndustries()->getValues();
304
+            if(!is_array($values) || !in_array($industry,$values)){
305
+                $job->getClassifications()->getIndustries()->getItems()->add($industry);
306
+            }
307
+        }
308
+    }
309 309
 	
310
-	/**
311
-	 * @param array $categories
312
-	 *
313
-	 * @return mixed
314
-	 */
315
-	private function getCategories(array $categories)
316
-	{
317
-		$catRepo = $this->getCategoriesRepository();
310
+    /**
311
+     * @param array $categories
312
+     *
313
+     * @return mixed
314
+     */
315
+    private function getCategories(array $categories)
316
+    {
317
+        $catRepo = $this->getCategoriesRepository();
318 318
 		
319
-		// get a professions
320
-		$qb = $catRepo->createQueryBuilder()
321
-		              ->field('name')->in($categories)
322
-		              ->getQuery()
323
-		;
324
-		$results = $qb->execute();
325
-		return $results->toArray();
326
-	}
319
+        // get a professions
320
+        $qb = $catRepo->createQueryBuilder()
321
+                        ->field('name')->in($categories)
322
+                        ->getQuery()
323
+        ;
324
+        $results = $qb->execute();
325
+        return $results->toArray();
326
+    }
327 327
 	
328 328
 	
329
-	/**
330
-	 * @return Job
331
-	 */
332
-	private function getCurrentUserJobDraft($jobTitle)
333
-	{
334
-		$repo = $this->getJobRepository();
335
-		$user = $this->getCurrentUser();
329
+    /**
330
+     * @return Job
331
+     */
332
+    private function getCurrentUserJobDraft($jobTitle)
333
+    {
334
+        $repo = $this->getJobRepository();
335
+        $user = $this->getCurrentUser();
336 336
 		
337
-		$job = $repo->findDraft($user);
337
+        $job = $repo->findDraft($user);
338 338
 		
339
-		if(is_null($job)){
340
-			$job = new Job();
341
-			$job
342
-				->setUser($user)
343
-				->setOrganization($user->getOrganization()->getOrganization())
344
-				->setStatus(StatusInterface::CREATED)
345
-			;
346
-			$job->setIsDraft(true);
347
-		}
348
-		$job->setTitle($jobTitle);
349
-		$repo->store($job);
350
-		return $job;
351
-	}
339
+        if(is_null($job)){
340
+            $job = new Job();
341
+            $job
342
+                ->setUser($user)
343
+                ->setOrganization($user->getOrganization()->getOrganization())
344
+                ->setStatus(StatusInterface::CREATED)
345
+            ;
346
+            $job->setIsDraft(true);
347
+        }
348
+        $job->setTitle($jobTitle);
349
+        $repo->store($job);
350
+        return $job;
351
+    }
352 352
 }
353 353
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
 	{
58 58
 		$repo = static::$jobRepo;
59 59
 		$results = $repo->findBy(['user' => $user]);
60
-		foreach($results as $result){
61
-			$repo->remove($result,true);
60
+		foreach ($results as $result) {
61
+			$repo->remove($result, true);
62 62
 		}
63 63
 	}
64 64
 	
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	public function beforeScenario(BeforeScenarioScope $scope)
71 71
 	{
72 72
 		$this->select2Context = $scope->getEnvironment()->getContext(Select2Context::class);
73
-		if(is_null(static::$jobRepo)){
73
+		if (is_null(static::$jobRepo)) {
74 74
 			$this->gatherContexts($scope);
75 75
 			static::$jobRepo = $this->getJobRepository();
76 76
 		}
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	public function iGoToEditJobWithTitle($jobTitle)
109 109
 	{
110 110
 		$job = $this->getJobRepository()->findOneBy(['title' => $jobTitle]);
111
-		if(!$job instanceof Job){
112
-			throw new \Exception(sprintf('Job with title "%s" is not found',$jobTitle));
111
+		if (!$job instanceof Job) {
112
+			throw new \Exception(sprintf('Job with title "%s" is not found', $jobTitle));
113 113
 		}
114 114
 		$this->currentJob = $job;
115 115
 		$url = '/en/jobs/edit?id='.$job->getId();
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 		$user = $this->getCurrentUser();
136 136
 		$jobRepository = $this->getJobRepository();
137 137
 		$results = $jobRepository->getUserJobs($user->getId());
138
-		foreach($results as $job){
139
-			$jobRepository->remove($job,true);
138
+		foreach ($results as $job) {
139
+			$jobRepository->remove($job, true);
140 140
 		}
141 141
 		$this->currentJob = null;
142 142
 	}
@@ -145,16 +145,16 @@  discard block
 block discarded – undo
145 145
 	 * @When I fill job location search with :search and choose :choice
146 146
 	 *
147 147
 	 */
148
-	public function iFillJobLocationAndChoose($search,$choice)
148
+	public function iFillJobLocationAndChoose($search, $choice)
149 149
 	{
150 150
 		$select2 = $this->select2Context;
151
-		$select2->iFillInSelect2FieldWith('jobBase[geoLocation]',$search,$choice);
151
+		$select2->iFillInSelect2FieldWith('jobBase[geoLocation]', $search, $choice);
152 152
 	}
153 153
 	
154 154
 	/**
155 155
 	 * @When I choose :value from :field
156 156
 	 */
157
-	public function iJobClassificationSelect($value,$field)
157
+	public function iJobClassificationSelect($value, $field)
158 158
 	{
159 159
 		$field = Inflector::camelize($field);
160 160
 		
@@ -170,18 +170,18 @@  discard block
 block discarded – undo
170 170
 			'employmentTypes'    => "select#classifications-employmentTypes",
171 171
 		];
172 172
 		
173
-		if(!isset($mapSelect2[$field])){
173
+		if (!isset($mapSelect2[$field])) {
174 174
 			throw new \Exception('Undefined field selection value "'.$field.'"');
175 175
 		}
176 176
 		
177 177
 		$multipleField = $mapMultiple[$field];
178 178
 		$page = $this->minkContext->getSession()->getPage();
179
-		$element = $page->find('css',$mapMultiple[$field]);
180
-		if(!is_null($element) && $element->getAttribute('multiple')=='multiple'){
181
-			$this->minkContext->selectOption($value,$multipleField);
182
-		}else{
179
+		$element = $page->find('css', $mapMultiple[$field]);
180
+		if (!is_null($element) && $element->getAttribute('multiple') == 'multiple') {
181
+			$this->minkContext->selectOption($value, $multipleField);
182
+		} else {
183 183
 			$locator = $mapSelect2[$field];
184
-			$this->select2Context->iFillInSelect2Field($locator,$value);
184
+			$this->select2Context->iFillInSelect2Field($locator, $value);
185 185
 		}
186 186
 	}
187 187
 	
@@ -205,62 +205,62 @@  discard block
 block discarded – undo
205 205
 	 * @When I have a :status job with the following:
206 206
 	 * @param TableNode $fields
207 207
 	 */
208
-	public function iHaveAJobWithTheFollowing($status,TableNode $fields)
208
+	public function iHaveAJobWithTheFollowing($status, TableNode $fields)
209 209
 	{
210 210
 		$normalizedField = [
211 211
 			'template' => 'modern',
212 212
 		];
213
-		foreach($fields->getRowsHash() as $field => $value){
213
+		foreach ($fields->getRowsHash() as $field => $value) {
214 214
 			$field = Inflector::camelize($field);
215
-			if($field == 'professions' || $field == 'industries'){
216
-				$value = explode(',',$value);
215
+			if ($field == 'professions' || $field == 'industries') {
216
+				$value = explode(',', $value);
217 217
 			}
218 218
 			$normalizedField[$field] = $value;
219 219
 		}
220 220
 		$jobRepo = $this->getJobRepository();
221 221
 		$job = $jobRepo->findOneBy(['title' => $normalizedField['title']]);
222
-		if(!$job instanceof Job){
222
+		if (!$job instanceof Job) {
223 223
 			$job = new Job();
224 224
 			$job->setTitle($normalizedField['title']);
225 225
 		}
226
-		if(isset($normalizedField['user'])){
226
+		if (isset($normalizedField['user'])) {
227 227
 			/* @var $userRepo UserRepository */
228 228
 			$userRepo = $this->getRepository('Auth\Entity\User');
229 229
 			$user = $userRepo->findOneBy(['login' => $normalizedField['user']]);
230
-			if($user instanceof User){
230
+			if ($user instanceof User) {
231 231
 				$job->setUser($user);
232 232
 				$job->setOrganization($user->getOrganization()->getOrganization());
233
-			}else{
233
+			} else {
234 234
 				throw new \Exception('There is no user with this login:"'.$normalizedField['user'.'"']);
235 235
 			}
236 236
 		}
237 237
 		
238
-		if($status == 'draft'){
238
+		if ($status == 'draft') {
239 239
 			$job->setIsDraft(true);
240
-		}elseif($status == 'published'){
240
+		}elseif ($status == 'published') {
241 241
 			$job->setIsDraft(false);
242 242
 			$job->setDatePublishStart(new \DateTime());
243 243
 		}
244 244
 		$job->setStatus(Status::ACTIVE);
245 245
 		
246
-		if(isset($normalizedField['location'])){
247
-			$this->setLocation($job,$normalizedField['location']);
246
+		if (isset($normalizedField['location'])) {
247
+			$this->setLocation($job, $normalizedField['location']);
248 248
 		}
249
-		if(isset($normalizedField['companyName'])){
249
+		if (isset($normalizedField['companyName'])) {
250 250
 			//$job->setCompany($normalizedField['companyName']);
251 251
 		}
252
-		if(isset($normalizedField['professions'])){
253
-			$this->addProfessions($job,$normalizedField['professions']);
252
+		if (isset($normalizedField['professions'])) {
253
+			$this->addProfessions($job, $normalizedField['professions']);
254 254
 		}
255 255
 		
256
-		if(isset($normalizedField['industries'])){
257
-			$this->addIndustries($job,$normalizedField['industries']);
256
+		if (isset($normalizedField['industries'])) {
257
+			$this->addIndustries($job, $normalizedField['industries']);
258 258
 		}
259
-		if(isset($normalizedField['employmentTypes'])){
259
+		if (isset($normalizedField['employmentTypes'])) {
260 260
 			$types = $this->getCategories([$normalizedField['employmentTypes']]);
261 261
 			$type = array_shift($types);
262 262
 			$values = $job->getClassifications()->getEmploymentTypes()->getValues();
263
-			if(!is_array($values) || !in_array($type,$values)){
263
+			if (!is_array($values) || !in_array($type, $values)) {
264 264
 				$job->getClassifications()->getEmploymentTypes()->getItems()->add($type);
265 265
 			}
266 266
 		}
@@ -279,18 +279,18 @@  discard block
 block discarded – undo
279 279
 		$location->fromString($serialized);
280 280
 		
281 281
 		$locations = $job->getLocations();
282
-		if(count($locations)){
282
+		if (count($locations)) {
283 283
 			$locations->clear();
284 284
 		}
285 285
 		$job->getLocations()->add($location);
286 286
 	}
287 287
 	
288
-	private function addProfessions(Job &$job,$terms)
288
+	private function addProfessions(Job &$job, $terms)
289 289
 	{
290 290
 		$professions = $this->getCategories($terms);
291
-		foreach($professions as $profession){
291
+		foreach ($professions as $profession) {
292 292
 			$values = $job->getClassifications()->getProfessions()->getValues();
293
-			if(!is_array($values) || !in_array($profession,$values)){
293
+			if (!is_array($values) || !in_array($profession, $values)) {
294 294
 				$job->getClassifications()->getProfessions()->getItems()->add($profession);
295 295
 			}
296 296
 		}
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
 	private function addIndustries(Job &$job, $terms)
300 300
 	{
301 301
 		$industries = $this->getCategories($terms);
302
-		foreach($industries as $industry){
302
+		foreach ($industries as $industry) {
303 303
 			$values = $job->getClassifications()->getIndustries()->getValues();
304
-			if(!is_array($values) || !in_array($industry,$values)){
304
+			if (!is_array($values) || !in_array($industry, $values)) {
305 305
 				$job->getClassifications()->getIndustries()->getItems()->add($industry);
306 306
 			}
307 307
 		}
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 		
337 337
 		$job = $repo->findDraft($user);
338 338
 		
339
-		if(is_null($job)){
339
+		if (is_null($job)) {
340 340
 			$job = new Job();
341 341
 			$job
342 342
 				->setUser($user)
Please login to merge, or discard this patch.