Completed
Push — master ( 858bee...ca95b0 )
by Pavel
10s
created
src/AppBundle/Services/AdminCreator.php 1 patch
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,9 +42,11 @@
 block discarded – undo
42 42
 
43 43
         $em = $this->doctrine->getManager();
44 44
         $user = $em->getRepository('AppBundle:User')->findBy(['email' => $email]);
45
-        if (!$user)
46
-            $user = new User();
47
-        else $user = $user[0];
45
+        if (!$user) {
46
+                    $user = new User();
47
+        } else {
48
+            $user = $user[0];
49
+        }
48 50
 
49 51
         $pass = $this->userPasswordEncoder->encodePassword($user, $password);
50 52
         $user->setEmail($email);
Please login to merge, or discard this patch.
src/AppBundle/Services/CheckAnswerV0.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,8 +64,7 @@
 block discarded – undo
64 64
                 $result = $sumTrueCorrect != 0 ? 1 / $sumTrueCorrect / 2 : 0;
65 65
             } elseif ($countFalseAnswers > 1) {
66 66
                 $result = 0;
67
-            }
68
-            else {
67
+            } else {
69 68
                 $result = $sumTrueCorrect != 0 ? 1 / $sumTrueCorrect : 0;
70 69
             }
71 70
             //third type question
Please login to merge, or discard this patch.
src/AppBundle/Services/PassManager.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -56,8 +56,9 @@  discard block
 block discarded – undo
56 56
             return $this->generateOutput('error', 403, 'You do not have access to this module');
57 57
         }
58 58
 
59
-        if ($moduleUser->getAttempts() == $moduleUser->getModule()->getAttempts())
60
-            return $this->generateOutput('error', 403, 'Your attempts are exhausted');
59
+        if ($moduleUser->getAttempts() == $moduleUser->getModule()->getAttempts()) {
60
+                    return $this->generateOutput('error', 403, 'Your attempts are exhausted');
61
+        }
61 62
 
62 63
         $lastPass = $moduleUser->getPassModules()->last();
63 64
 
@@ -68,8 +69,9 @@  discard block
 block discarded – undo
68 69
 
69 70
         $time_residue = $this->checkDatePass($lastPass);
70 71
 
71
-        if (!$time_residue)
72
-            $this->identPass($idModule);
72
+        if (!$time_residue) {
73
+                    $this->identPass($idModule);
74
+        }
73 75
 
74 76
         return $this->generateOutput('redirect_to_pass', 301, $lastPass->getId());
75 77
     }
@@ -137,8 +139,9 @@  discard block
 block discarded – undo
137 139
             $firstQuestionForPass = $this->doctrine->getRepository('AppBundle:Question')
138 140
                 ->getFirstQuestionForPass($passModule->getId());
139 141
 
140
-            if(null === $firstQuestionForPass)
141
-                return $this->generateOutput('error', 500, 'This module does not have any questions ;(');
142
+            if(null === $firstQuestionForPass) {
143
+                            return $this->generateOutput('error', 500, 'This module does not have any questions ;(');
144
+            }
142 145
 
143 146
             $passModule->setCurrentQuestion($firstQuestionForPass);
144 147
             $this->doctrine->getEntityManager()->flush();
@@ -150,8 +153,9 @@  discard block
 block discarded – undo
150 153
 
151 154
         $time_residue = $this->checkDatePass($passModule);
152 155
 
153
-        if (!$time_residue)
154
-            return $this->generateOutput('error', 403, 'This pass is overdue ;(');
156
+        if (!$time_residue) {
157
+                    return $this->generateOutput('error', 403, 'This pass is overdue ;(');
158
+        }
155 159
 
156 160
 
157 161
         $currentQuestion = $passModule->getCurrentQuestion();
Please login to merge, or discard this patch.
src/AppBundle/Entity/PassModule.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -261,8 +261,9 @@
 block discarded – undo
261 261
 
262 262
     public function getStateResult()
263 263
     {
264
-        if($this->timeFinish === null)
265
-                return self::STATE_EXPIRED;
264
+        if($this->timeFinish === null) {
265
+                        return self::STATE_EXPIRED;
266
+        }
266 267
 
267 268
         return $this->getPercentResult() >= $this->getModuleUser()->getModule()->getPersentSuccess() ?
268 269
                 self::STATE_PASSED : self::STATE_FAILED;
Please login to merge, or discard this patch.
src/AppBundle/Services/CheckAnwers.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,8 +40,9 @@  discard block
 block discarded – undo
40 40
             $data["answer_{$item->getId()}"] ? $countAllChecks++ : null;
41 41
             if ($item->getCorrectly() === $data["answer_{$item->getId()}"]) {
42 42
                 $sumAllCorrect++;
43
-                if ($item->getCorrectly())
44
-                    $sumCorrectChecks++;
43
+                if ($item->getCorrectly()) {
44
+                                    $sumCorrectChecks++;
45
+                }
45 46
             } else {
46 47
                 if ($item->getCorrectly() === false) {
47 48
                     $sumFalseAnswers++;
@@ -58,8 +59,9 @@  discard block
 block discarded – undo
58 59
         if ($question->getAllIncorrect() || $data['answer_all_incorrect']) {
59 60
             if ($question->getAllIncorrect() === $data['answer_all_incorrect'] && $question->getAllIncorrect() === true &&
60 61
                 $sumAllCorrect == $countOriginalAnswers
61
-            )
62
-                return 1;
62
+            ) {
63
+                            return 1;
64
+            }
63 65
 
64 66
             return 0;
65 67
         }
Please login to merge, or discard this patch.
src/AppBundle/Controller/Account/PassingTestController.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,11 +57,13 @@
 block discarded – undo
57 57
                         ->getDonePassModuleByIdAndUser($idPass,$this->getUser()->getId())
58 58
                         ;
59 59
 
60
-        if($passModule === null)
61
-            throw new HttpException(403, 'You don\'t have permission for look this data');
60
+        if($passModule === null) {
61
+                    throw new HttpException(403, 'You don\'t have permission for look this data');
62
+        }
62 63
 
63
-        if($passModule->getStateResult() === PassModule::STATE_EXPIRED)
64
-            throw new HttpException(403, 'This pass expired.');
64
+        if($passModule->getStateResult() === PassModule::STATE_EXPIRED) {
65
+                    throw new HttpException(403, 'This pass expired.');
66
+        }
65 67
 
66 68
         return ['passModule' => $passModule];
67 69
     }
Please login to merge, or discard this patch.
src/AppBundle/Controller/RegistrationController.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,8 +43,9 @@
 block discarded – undo
43 43
     public function afterSocLogin()
44 44
     {
45 45
         $user = $this->getUser();
46
-        if (!$user->getPassword())
47
-            return $this->redirectToRoute('update_profile');
46
+        if (!$user->getPassword()) {
47
+                    return $this->redirectToRoute('update_profile');
48
+        }
48 49
 
49 50
         return $this->redirectToRoute('account');
50 51
     }
Please login to merge, or discard this patch.
src/AppBundle/Form/QuestionType.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@
 block discarded – undo
26 26
             'choices_as_values' => true,
27 27
         ];
28 28
 
29
-        if($newSort)$sortAttrs['data'] = $newSort;
29
+        if($newSort) {
30
+            $sortAttrs['data'] = $newSort;
31
+        }
30 32
 
31 33
         $builder
32 34
             ->add('textQuestion', TextType::class, [
Please login to merge, or discard this patch.