@@ -17,16 +17,16 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | public function buildForm(FormBuilderInterface $builder, array $options) |
| 19 | 19 | { |
| 20 | - $newSort = $options['new_sort']; |
|
| 20 | + $newSort = $options[ 'new_sort' ]; |
|
| 21 | 21 | $sortAttrs = [ |
| 22 | 22 | 'attr' => [ |
| 23 | 23 | 'class' => 'form-control', |
| 24 | 24 | ], |
| 25 | - 'choices' => [1=>1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], |
|
| 25 | + 'choices' => [ 1=>1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ], |
|
| 26 | 26 | 'choices_as_values' => true, |
| 27 | 27 | ]; |
| 28 | 28 | |
| 29 | - if($newSort)$sortAttrs['data'] = $newSort; |
|
| 29 | + if ($newSort)$sortAttrs[ 'data' ] = $newSort; |
|
| 30 | 30 | |
| 31 | 31 | $builder |
| 32 | 32 | ->add('textQuestion', TextType::class, [ |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | ], |
| 51 | 51 | |
| 52 | 52 | ]) |
| 53 | - ->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) { |
|
| 53 | + ->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) { |
|
| 54 | 54 | $data = $event->getData(); |
| 55 | 55 | |
| 56 | 56 | foreach ($data->getAnswers() as $item) { |
@@ -26,7 +26,9 @@ |
||
| 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, [ |
@@ -98,14 +98,14 @@ |
||
| 98 | 98 | ->setBody( |
| 99 | 99 | $this->templating->render( |
| 100 | 100 | '@App/Emails/checkWithRecovery.html.twig', |
| 101 | - ['hash' => $hash, 'password' => $password] |
|
| 101 | + [ 'hash' => $hash, 'password' => $password ] |
|
| 102 | 102 | ), |
| 103 | 103 | 'text/html' |
| 104 | 104 | ); |
| 105 | 105 | |
| 106 | 106 | $this->mailer->send($message); |
| 107 | 107 | |
| 108 | - return [$password, $hash]; |
|
| 108 | + return [ $password, $hash ]; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | |
@@ -14,10 +14,10 @@ |
||
| 14 | 14 | public function generator() |
| 15 | 15 | { |
| 16 | 16 | $key = ''; |
| 17 | - $array = array_merge(range('A','Z'),range('a','z'),range('0','9')); |
|
| 18 | - $c = count($array)-1; |
|
| 19 | - for($i = 0; $i < 6; $i++) { |
|
| 20 | - $key .= $array[rand(0, $c)]; |
|
| 17 | + $array = array_merge(range('A', 'Z'), range('a', 'z'), range('0', '9')); |
|
| 18 | + $c = count($array) - 1; |
|
| 19 | + for ($i = 0; $i < 6; $i++) { |
|
| 20 | + $key .= $array[ rand(0, $c) ]; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | return $key; |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | $module = $em->getRepository('AppBundle:Module')->find($idModule); |
| 28 | 28 | $question = new Question(); |
| 29 | 29 | |
| 30 | - $maxSort = $em->getRepository('AppBundle:Question')->findMaxSortByModuleId($idModule); |
|
| 30 | + $maxSort = $em->getRepository('AppBundle:Question')->findMaxSortByModuleId($idModule); |
|
| 31 | 31 | |
| 32 | - $form = $this->createForm(QuestionType::class, $question, ['new_sort'=> ++$maxSort['max_sort']]); |
|
| 32 | + $form = $this->createForm(QuestionType::class, $question, [ 'new_sort'=> ++$maxSort[ 'max_sort' ] ]); |
|
| 33 | 33 | |
| 34 | 34 | $form->handleRequest($request); |
| 35 | 35 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - return ['form' => $form->createView(), |
|
| 45 | + return [ 'form' => $form->createView(), |
|
| 46 | 46 | 'idModule' => $idModule |
| 47 | 47 | ]; |
| 48 | 48 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | return $this->redirectToRoute('edit_question', array('id' => $id, 'idModule' => $idModule)); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - return ['form' => $form->createView(), |
|
| 85 | + return [ 'form' => $form->createView(), |
|
| 86 | 86 | 'idModule' => $idModule |
| 87 | 87 | ]; |
| 88 | 88 | } |
@@ -116,10 +116,10 @@ discard block |
||
| 116 | 116 | $question = $em->getRepository('AppBundle:Question') |
| 117 | 117 | ->findByModuleWithSorting($idModule); |
| 118 | 118 | |
| 119 | - $form_delete = []; |
|
| 119 | + $form_delete = [ ]; |
|
| 120 | 120 | |
| 121 | 121 | foreach ($question as $item) { |
| 122 | - $form_delete[$item->getId()] = $this->createFormDelete($item->getId(), $idModule)->createView(); |
|
| 122 | + $form_delete[ $item->getId() ] = $this->createFormDelete($item->getId(), $idModule)->createView(); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | return [ |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | private function createFormDelete($id, $idModule) |
| 137 | 137 | { |
| 138 | 138 | return $this->createFormBuilder() |
| 139 | - ->setAction($this->generateUrl('remove_question', ['id' => $id, 'idModule' => $idModule])) |
|
| 139 | + ->setAction($this->generateUrl('remove_question', [ 'id' => $id, 'idModule' => $idModule ])) |
|
| 140 | 140 | ->setMethod('DELETE') |
| 141 | 141 | ->add('submit', SubmitType::class, [ |
| 142 | 142 | 'label' => ' ', |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - return ['form' => $form->createView()]; |
|
| 37 | + return [ 'form' => $form->createView() ]; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | return $this->redirectToRoute('show_module'); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - return ['module' => $module, |
|
| 61 | - 'form' => $form->createView()]; |
|
| 60 | + return [ 'module' => $module, |
|
| 61 | + 'form' => $form->createView() ]; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -101,10 +101,10 @@ discard block |
||
| 101 | 101 | $this->container->getParameter('knp_paginator.page_range') |
| 102 | 102 | ); |
| 103 | 103 | |
| 104 | - $form_delete = []; |
|
| 104 | + $form_delete = [ ]; |
|
| 105 | 105 | |
| 106 | 106 | foreach ($module as $item) { |
| 107 | - $form_delete[$item->getId()] = $this->createFormDelete($item->getId())->createView(); |
|
| 107 | + $form_delete[ $item->getId() ] = $this->createFormDelete($item->getId())->createView(); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | return [ |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | private function createFormDelete($id) |
| 121 | 121 | { |
| 122 | 122 | return $this->createFormBuilder() |
| 123 | - ->setAction($this->generateUrl('remove_module', ['id' => $id])) |
|
| 123 | + ->setAction($this->generateUrl('remove_module', [ 'id' => $id ])) |
|
| 124 | 124 | ->setMethod('DELETE') |
| 125 | 125 | ->add('submit', SubmitType::class, [ |
| 126 | 126 | 'label' => ' ', |
@@ -26,10 +26,10 @@ |
||
| 26 | 26 | $countQuestions = $em->getRepository('AppBundle:Question')->findCountQuestions(); |
| 27 | 27 | |
| 28 | 28 | return [ |
| 29 | - 'count_users' => $countUsers['count_u'], |
|
| 30 | - 'count_modules' => $countModules['count_m'], |
|
| 31 | - 'count_categories' => $countCategories['count_c'], |
|
| 32 | - 'count_questions' => $countQuestions['count_q'] |
|
| 29 | + 'count_users' => $countUsers[ 'count_u' ], |
|
| 30 | + 'count_modules' => $countModules[ 'count_m' ], |
|
| 31 | + 'count_categories' => $countCategories[ 'count_c' ], |
|
| 32 | + 'count_questions' => $countQuestions[ 'count_q' ] |
|
| 33 | 33 | ]; |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $email = trim($request->get('email')); |
| 108 | 108 | |
| 109 | 109 | $user = $em->getRepository('AppBundle:User') |
| 110 | - ->findOneBy(['email' => $email]); |
|
| 110 | + ->findOneBy([ 'email' => $email ]); |
|
| 111 | 111 | |
| 112 | 112 | if ($user && $user->isAccountNonLocked() == true) { |
| 113 | 113 | list($password, $hash) = $this->get('app.custom.mailer')->sendMailCheckWithRecovery($user->getEmail()); |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | return $this->redirectToRoute('homepage'); |
| 134 | 134 | } else { |
| 135 | 135 | |
| 136 | - return []; |
|
| 136 | + return [ ]; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $em = $this->getDoctrine()->getManager(); |
| 148 | 148 | |
| 149 | 149 | $user = $em->getRepository('AppBundle:User') |
| 150 | - ->findOneBy(['hash' => $hash]); |
|
| 150 | + ->findOneBy([ 'hash' => $hash ]); |
|
| 151 | 151 | |
| 152 | 152 | if ($user) { |
| 153 | 153 | $user->setPassword($user->getTmpPassword()); |