@@ -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 | { |
@@ -233,7 +233,7 @@ |
||
| 233 | 233 | */ |
| 234 | 234 | public function getRoles() |
| 235 | 235 | { |
| 236 | - return [$this->role]; |
|
| 236 | + return [ $this->role ]; |
|
| 237 | 237 | |
| 238 | 238 | } |
| 239 | 239 | |
@@ -41,10 +41,10 @@ |
||
| 41 | 41 | $role = User::ROLE_ADMIN; |
| 42 | 42 | |
| 43 | 43 | $em = $this->doctrine->getManager(); |
| 44 | - $user = $em->getRepository('AppBundle:User')->findBy(['email' => $email]); |
|
| 44 | + $user = $em->getRepository('AppBundle:User')->findBy([ 'email' => $email ]); |
|
| 45 | 45 | if (!$user) |
| 46 | 46 | $user = new User(); |
| 47 | - else $user = $user[0]; |
|
| 47 | + else $user = $user[ 0 ]; |
|
| 48 | 48 | |
| 49 | 49 | $pass = $this->userPasswordEncoder->encodePassword($user, $password); |
| 50 | 50 | $user->setEmail($email); |
@@ -43,6 +43,6 @@ |
||
| 43 | 43 | $this->getContainer()->get('app.admin.creator') |
| 44 | 44 | ->create($email, $password, $firstName, $lastName); |
| 45 | 45 | |
| 46 | - $output->writeln(sprintf('User <comment>%s</comment> was created/updated', $firstName.' '.$lastName)); |
|
| 46 | + $output->writeln(sprintf('User <comment>%s</comment> was created/updated', $firstName . ' ' . $lastName)); |
|
| 47 | 47 | } |
| 48 | 48 | } |
@@ -18,6 +18,6 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | public function indexAction() |
| 20 | 20 | { |
| 21 | - return []; |
|
| 21 | + return [ ]; |
|
| 22 | 22 | } |
| 23 | 23 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | $em = $this->em; |
| 43 | 43 | $type = $response->getResourceOwner()->getName(); |
| 44 | - $user = $em->getRepository('AppBundle:User')->findOneBy(['email' => $response->getEmail()]); |
|
| 44 | + $user = $em->getRepository('AppBundle:User')->findOneBy([ 'email' => $response->getEmail() ]); |
|
| 45 | 45 | if ($user === null) { |
| 46 | 46 | $user = new User(); |
| 47 | 47 | $user->setEmail($response->getEmail()) |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function loadUserByUsername($username) |
| 91 | 91 | { |
| 92 | - $user = $this->em->getRepository('AppBundle:User')->findOneBy(['email' => $username]); |
|
| 92 | + $user = $this->em->getRepository('AppBundle:User')->findOneBy([ 'email' => $username ]); |
|
| 93 | 93 | if (!$user) { |
| 94 | 94 | throw new UsernameNotFoundException(sprintf("User '%s' not found.", $username)); |
| 95 | 95 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $em = $this->doctrine->getManager(); |
| 26 | 26 | $question = $em->getRepository('AppBundle:Question') |
| 27 | - ->find($data['idQuestion']); |
|
| 27 | + ->find($data[ 'idQuestion' ]); |
|
| 28 | 28 | |
| 29 | 29 | $originalAnswers = $question->getAnswers(); |
| 30 | 30 | $countOriginalAnswers = $question->getCountAnswers(); |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | foreach ($originalAnswers as $item) { |
| 39 | 39 | $item->getCorrectly() ? $countAllTrueAnswers++ : null; |
| 40 | - $data["answer_{$item->getId()}"] ? $countAllChecks++ : null; |
|
| 41 | - if ($item->getCorrectly() === $data["answer_{$item->getId()}"]) { |
|
| 40 | + $data[ "answer_{$item->getId()}" ] ? $countAllChecks++ : null; |
|
| 41 | + if ($item->getCorrectly() === $data[ "answer_{$item->getId()}" ]) { |
|
| 42 | 42 | $sumAllCorrect++; |
| 43 | 43 | if ($item->getCorrectly()) |
| 44 | 44 | $sumCorrectChecks++; |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | $maxCountAnswers = $countAllTrueAnswers; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - if ($question->getAllIncorrect() || $data['answer_all_incorrect']) { |
|
| 59 | - if ($question->getAllIncorrect() === $data['answer_all_incorrect'] && $question->getAllIncorrect() === true && |
|
| 58 | + if ($question->getAllIncorrect() || $data[ 'answer_all_incorrect' ]) { |
|
| 59 | + if ($question->getAllIncorrect() === $data[ 'answer_all_incorrect' ] && $question->getAllIncorrect() === true && |
|
| 60 | 60 | $sumAllCorrect == $countOriginalAnswers |
| 61 | 61 | ) |
| 62 | 62 | return $result = 1; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | if ($sumAllCorrect && $sumCorrectChecks && $countAllChecks <= $maxCountAnswers) { |
| 69 | 69 | // second type question |
| 70 | 70 | if ($countAllTrueAnswers == 1) { |
| 71 | - $result = (1 / $maxCountAnswers) * ($sumCorrectChecks + ($sumFalseAnswers > 0 ? 0: 1)); |
|
| 71 | + $result = (1 / $maxCountAnswers) * ($sumCorrectChecks + ($sumFalseAnswers > 0 ? 0 : 1)); |
|
| 72 | 72 | } |
| 73 | 73 | // third type question |
| 74 | 74 | elseif ($countAllTrueAnswers > 1) { |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $em = $this->doctrine->getManager(); |
| 26 | 26 | $question = $em->getRepository('AppBundle:Question') |
| 27 | - ->find($data['idQuestion']); |
|
| 27 | + ->find($data[ 'idQuestion' ]); |
|
| 28 | 28 | |
| 29 | 29 | $originalAnswers = $question->getAnswers(); |
| 30 | 30 | $countOriginalAnswers = count($originalAnswers); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | foreach ($originalAnswers as $item) { |
| 39 | 39 | $item->getCorrectly() ? $countAllTrueAnswers++ : $countAllFalseAnswers++; |
| 40 | - if ($item->getCorrectly() === $data["answer_{$item->getId()}"]) { |
|
| 40 | + if ($item->getCorrectly() === $data[ "answer_{$item->getId()}" ]) { |
|
| 41 | 41 | if ($item->getCorrectly() === true) { |
| 42 | 42 | $sumTrueCorrect++; |
| 43 | 43 | } |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | //first type question |
| 52 | - if ($question->getAllIncorrect() || $data['answer_all_incorrect']) { |
|
| 53 | - if ($question->getAllIncorrect() === $data['answer_all_incorrect'] && $question->getAllIncorrect() === true && $sumTrueCorrect == 0) { |
|
| 52 | + if ($question->getAllIncorrect() || $data[ 'answer_all_incorrect' ]) { |
|
| 53 | + if ($question->getAllIncorrect() === $data[ 'answer_all_incorrect' ] && $question->getAllIncorrect() === true && $sumTrueCorrect == 0) { |
|
| 54 | 54 | |
| 55 | 55 | return $result = 1; |
| 56 | 56 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | // $result = $sumTrueCorrect != 0 ? ((1 / $countAllTrueAnswers) * $sumTrueCorrect) - ((1 / $countAllFalseAnswers) * $countFalseAnswers) : 0; |
| 75 | 75 | $result = $sumAllCorrect != 0 ? ((1 / $countOriginalAnswers) * $sumAllCorrect) : 0; |
| 76 | 76 | } else { |
| 77 | - $result = 0; |
|
| 77 | + $result = 0; |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |