Completed
Branch develop (b9c805)
by Pavel
06:33
created
src/AppBundle/Services/PassManager.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         $dateEstimate = $pass->getTimeStart()
82 82
             ->modify("+{$pass->getTimePeriod()} minutes");
83 83
 
84
-        if($nowDate > $dateEstimate){
84
+        if ($nowDate > $dateEstimate) {
85 85
          //   $pass->setIsActive(false);
86 86
         //    $this->doctrine->getEntityManager()->flush();
87 87
             $this->deactivation->deactivation($pass);
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
             $firstQuestionForPass = $this->doctrine->getRepository('AppBundle:Question')
138 138
                 ->getFirstQuestionForPass($passModule->getId());
139 139
 
140
-            if(null === $firstQuestionForPass)
140
+            if (null === $firstQuestionForPass)
141 141
                 return $this->generateOutput('error', 500, 'This module does not have any questions ;(');
142 142
 
143 143
             $passModule->setCurrentQuestion($firstQuestionForPass);
144 144
             $this->doctrine->getEntityManager()->flush();
145 145
         }
146 146
 
147
-        if(!($passModule->getIsActive())){
147
+        if (!($passModule->getIsActive())) {
148 148
             return $this->generateOutput('error', 403, 'This pass is not active ;(');
149 149
         }
150 150
 
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
             'idPassModule' => $idPassModule,
162 162
             'answers' => $currentQuestion->getAnswers()->toArray()
163 163
         ]);
164
-        $form->add('submit', SubmitType::class, ['label' => 'Save', 'attr' => [ 'class' => 'btn btn-primary' ]]);
164
+        $form->add('submit', SubmitType::class, [ 'label' => 'Save', 'attr' => [ 'class' => 'btn btn-primary' ] ]);
165 165
 
166
-        $currentNumberQuestion = $passModule->getCountPassedQuestions()+1;
166
+        $currentNumberQuestion = $passModule->getCountPassedQuestions() + 1;
167 167
 
168 168
         return $this->generateOutput('ok', 200, [
169 169
             $form,
Please login to merge, or discard this patch.
src/AppBundle/Services/PassControl.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     {
34 34
         $rating = $this->checkAnswers->checkAnswers($data);
35 35
         $passModule = $this->doctrine->getRepository('AppBundle:PassModule')
36
-            ->findOneById($data['idPassModule']);
36
+            ->findOneById($data[ 'idPassModule' ]);
37 37
 
38 38
         $passModule->addAnsweredQuestionId($passModule->getCurrentQuestion()->getId());
39 39
 
@@ -43,18 +43,18 @@  discard block
 block discarded – undo
43 43
         $passModule->addRating($rating);
44 44
 
45 45
 
46
-        if($nextQuestionForPass === null) {
46
+        if ($nextQuestionForPass === null) {
47 47
           //  $passModule->setIsActive(false);
48 48
           //  $passModule->setTimeFinish(new \DateTime());
49 49
          //   $this->doctrine->getEntityManager()->flush();
50 50
             $timeFinish = new \DateTime();
51 51
             $this->deactivation->deactivation($passModule, $timeFinish);
52
-            return $this->generateOutput('redirect_to_result', 301, $data['idPassModule']);
52
+            return $this->generateOutput('redirect_to_result', 301, $data[ 'idPassModule' ]);
53 53
         }
54 54
 
55 55
         $passModule->setCurrentQuestion($nextQuestionForPass);
56 56
         $this->doctrine->getEntityManager()->flush();
57 57
 
58
-        return $this->generateOutput('redirect_to_pass', 301, $data['idPassModule']);
58
+        return $this->generateOutput('redirect_to_pass', 301, $data[ 'idPassModule' ]);
59 59
     }
60 60
 }
Please login to merge, or discard this patch.
src/AppBundle/Traits/GenerateOutput.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace AppBundle\Traits;
3 3
 
4
-trait GenerateOutput{
4
+trait GenerateOutput {
5 5
 
6 6
     private function generateOutput($status, $code, $message)
7 7
     {
Please login to merge, or discard this patch.
src/AppBundle/Tests/TestBaseWeb.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,24 +17,24 @@
 block discarded – undo
17 17
     public function setUp()
18 18
     {
19 19
         $this->client = static::createClient();
20
-        $this->runCommand(['command' => 'doctrine:database:create']);
21
-        $this->runCommand(['command' => 'doctrine:schema:update', '--force' => true]);
22
-        $this->runCommand(['command' => 'doctrine:fixtures:load', '--no-interaction' => true]);
20
+        $this->runCommand([ 'command' => 'doctrine:database:create' ]);
21
+        $this->runCommand([ 'command' => 'doctrine:schema:update', '--force' => true ]);
22
+        $this->runCommand([ 'command' => 'doctrine:fixtures:load', '--no-interaction' => true ]);
23 23
 
24 24
     }
25 25
 
26 26
     public function tearDown()
27 27
     {
28
-        $this->runCommand(['command' => 'doctrine:database:drop', '--force' => true]);
28
+        $this->runCommand([ 'command' => 'doctrine:database:drop', '--force' => true ]);
29 29
         $this->client = null;
30 30
     }
31 31
 
32
-    protected function runCommand(array $arguments = [])
32
+    protected function runCommand(array $arguments = [ ])
33 33
     {
34 34
         $application = new Application($this->client->getKernel());
35 35
         $application->setAutoExit(false);
36
-        $arguments['--quiet'] = true;
37
-        $arguments['-e'] = 'test';
36
+        $arguments[ '--quiet' ] = true;
37
+        $arguments[ '-e' ] = 'test';
38 38
         $input = new ArrayInput($arguments);
39 39
         $application->run($input, new ConsoleOutput());
40 40
     }
Please login to merge, or discard this patch.
src/AppBundle/Form/ModuleType.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,25 +23,25 @@  discard block
 block discarded – undo
23 23
                     'placeholder' => 'enter title'
24 24
                 ]
25 25
             ])
26
-            ->add('rating', TextType::class,[
26
+            ->add('rating', TextType::class, [
27 27
                 'attr' => [
28 28
                     'class' => 'form-control',
29 29
                     'placeholder' => 'enter rating'
30 30
                 ]
31 31
             ])
32
-            ->add('persentSuccess', TextType::class,[
32
+            ->add('persentSuccess', TextType::class, [
33 33
                 'attr' => [
34 34
                     'class' => 'form-control',
35 35
                     'placeholder' => 'enter persent'
36 36
                 ]
37 37
             ])
38
-            ->add('time', TextType::class,[
38
+            ->add('time', TextType::class, [
39 39
                 'attr' => [
40 40
                     'class' => 'form-control',
41 41
                     'placeholder' => 'enter time'
42 42
                 ]
43 43
             ])
44
-            ->add('attempts', TextType::class,[
44
+            ->add('attempts', TextType::class, [
45 45
                 'attr' => [
46 46
                     'class' => 'form-control',
47 47
                     'placeholder' => 'enter attempts'
@@ -49,19 +49,19 @@  discard block
 block discarded – undo
49 49
             ])
50 50
             ->add('category', EntityType::class, [
51 51
                 'class' => 'AppBundle\Entity\Category',
52
-                'query_builder' => function (EntityRepository $er) {
52
+                'query_builder' => function(EntityRepository $er) {
53 53
                     return $er->createQueryBuilder('c')
54 54
                         ->orderBy('c.title', 'ASC');
55 55
                 },
56 56
                 'label' => 'Category',
57 57
                 'property' => 'title',
58
-                'attr' => ['class' => 'chosen-select'],
58
+                'attr' => [ 'class' => 'chosen-select' ],
59 59
                 'required'  => true
60 60
             ])
61 61
             ->add('module_image', FileType::class, [
62 62
                 'required' => false
63 63
             ])
64
-            ->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event)  {
64
+            ->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) {
65 65
                 $data = $event->getData();
66 66
 
67 67
 
Please login to merge, or discard this patch.
src/AppBundle/Form/ModuleUserType.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,17 +12,17 @@
 block discarded – undo
12 12
 {
13 13
     public function buildForm(FormBuilderInterface $builder, array $options)
14 14
     {
15
-        $user = $options['user'];
15
+        $user = $options[ 'user' ];
16 16
 
17 17
         $builder
18 18
             ->add('module', EntityType::class, [
19 19
                 'class' => 'AppBundle\Entity\Module',
20
-                'query_builder' => function (EntityRepository $er) use ($user) {
20
+                'query_builder' => function(EntityRepository $er) use ($user) {
21 21
                     return $er->getFreeModulesForUserQuery($user);
22 22
                 },
23 23
                 'label' => 'Choose module',
24 24
                 'property' => 'title',
25
-                'attr' => ['class' => 'chosen-select'],
25
+                'attr' => [ 'class' => 'chosen-select' ],
26 26
                 'required'  => true
27 27
             ]);
28 28
     }
Please login to merge, or discard this patch.
src/AppBundle/Form/AnswerForPassType.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
 {
15 15
     public function buildForm(FormBuilderInterface $builder, array $options)
16 16
     {
17
-        $answers = $options['answers'];
18
-        $idQuestion = $options['idQuestion'];
19
-        $idPassModule = $options['idPassModule'];
17
+        $answers = $options[ 'answers' ];
18
+        $idQuestion = $options[ 'idQuestion' ];
19
+        $idPassModule = $options[ 'idPassModule' ];
20 20
 
21 21
         $builder
22 22
             ->add('idQuestion', HiddenType::class, [
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
                 'data' => $idPassModule,
27 27
             ]);
28 28
 
29
-        foreach($answers as $answer){
30
-            $builder->add('answer_' . $answer->getId(), CheckboxType::class,[
29
+        foreach ($answers as $answer) {
30
+            $builder->add('answer_' . $answer->getId(), CheckboxType::class, [
31 31
                 'label' => $answer->getTextAnswer(),
32 32
                 'required' => false
33 33
             ]);
34 34
         }
35 35
 
36
-        $builder->add('answer_all_incorrect', CheckboxType::class,[
36
+        $builder->add('answer_all_incorrect', CheckboxType::class, [
37 37
             'label'=>'Question has no correct answers',
38 38
             'required' => false
39 39
         ]);
Please login to merge, or discard this patch.
src/AppBundle/Form/AnswerType.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@
 block discarded – undo
13 13
     public function buildForm(FormBuilderInterface $builder, array $options)
14 14
     {
15 15
         $builder
16
-            ->add('textAnswer', TextType::class,[
16
+            ->add('textAnswer', TextType::class, [
17 17
                 'attr' => [
18 18
                     'class' => 'form-control',
19 19
                     'placeholder' => 'enter answer',
20 20
                     'style' => 'width:400px;'
21 21
                 ]
22 22
             ])
23
-            ->add('correctly', CheckboxType::class,[
23
+            ->add('correctly', CheckboxType::class, [
24 24
                 'required' => false
25 25
             ]);
26 26
        //     ->add('question', HiddenType::class);
Please login to merge, or discard this patch.
src/AppBundle/Form/QuestionType.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
                 ],
48 48
 
49 49
             ])
50
-            ->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event)  {
50
+            ->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) {
51 51
                 $data = $event->getData();
52 52
 
53 53
                 foreach ($data->getAnswers() as $item) {
Please login to merge, or discard this patch.