@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
248 | - * @return mixed |
|
248 | + * @return null|Category |
|
249 | 249 | */ |
250 | 250 | public function getCategory() |
251 | 251 | { |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | } |
254 | 254 | |
255 | 255 | /** |
256 | - * @param mixed $category |
|
256 | + * @param null|Category $category |
|
257 | 257 | */ |
258 | 258 | public function setCategory(Category $category = null) |
259 | 259 | { |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
264 | - * @return mixed |
|
264 | + * @return ArrayCollection |
|
265 | 265 | */ |
266 | 266 | public function getQuestions() |
267 | 267 | { |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | } |
289 | 289 | |
290 | 290 | /** |
291 | - * @return mixed |
|
291 | + * @return ArrayCollection |
|
292 | 292 | */ |
293 | 293 | public function getModulesUser() |
294 | 294 | { |
@@ -22,7 +22,6 @@ discard block |
||
22 | 22 | protected $service; |
23 | 23 | |
24 | 24 | /** |
25 | - * @param ImageManagerServices $container |
|
26 | 25 | */ |
27 | 26 | public function __construct(ImageManagerServices $service) |
28 | 27 | { |
@@ -30,7 +29,7 @@ discard block |
||
30 | 29 | } |
31 | 30 | |
32 | 31 | /** |
33 | - * @return array |
|
32 | + * @return string[] |
|
34 | 33 | */ |
35 | 34 | public function getSubscribedEvents() |
36 | 35 | { |
@@ -42,9 +42,11 @@ |
||
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); |
@@ -64,8 +64,7 @@ |
||
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 |
@@ -56,8 +56,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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(); |
@@ -261,8 +261,9 @@ |
||
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; |
@@ -40,8 +40,9 @@ discard block |
||
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 |
||
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 | } |
@@ -57,11 +57,13 @@ |
||
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 | } |
@@ -43,8 +43,9 @@ |
||
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 | } |