Completed
Branch develop (b9c805)
by Pavel
06:33
created
src/AppBundle/Entity/PassModule.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     {
90 90
         $this->isActive = true;
91 91
         $this->rating = 0;
92
-        $this->answeredQuestionIds = [];
92
+        $this->answeredQuestionIds = [ ];
93 93
     }
94 94
 
95 95
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      */
237 237
     public function addAnsweredQuestionId($questionId)
238 238
     {
239
-        $this->answeredQuestionIds[] = $questionId;
239
+        $this->answeredQuestionIds[ ] = $questionId;
240 240
 
241 241
         return $this;
242 242
     }
@@ -250,18 +250,18 @@  discard block
 block discarded – undo
250 250
     {
251 251
         $countQuestions = $this->getModuleUser()->getModule()->getCountQuestions();
252 252
         $maxResult = $this->getModuleUser()->getModule()->getRating();
253
-        return $this->rating * $maxResult / $countQuestions ;
253
+        return $this->rating * $maxResult / $countQuestions;
254 254
     }
255 255
 
256 256
     public function getPercentResult()
257 257
     {
258 258
         $countQuestions = $this->getModuleUser()->getModule()->getCountQuestions();
259
-        return $this->rating * 100 / $countQuestions ;
259
+        return $this->rating * 100 / $countQuestions;
260 260
     }
261 261
 
262 262
     public function getStateResult()
263 263
     {
264
-        if($this->timeFinish === null)
264
+        if ($this->timeFinish === null)
265 265
                 return self::STATE_EXPIRED;
266 266
 
267 267
         return $this->getPercentResult() >= $this->getModuleUser()->getModule()->getPersentSuccess() ?
Please login to merge, or discard this 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/Controller/Admin/ModuleController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     /**
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
         $em = $this->getDoctrine()->getManager();
89 89
 
90 90
         $module = $em->getRepository('AppBundle:Module')
91
-            ->findBy([],['createdAt' => 'DESC']);
91
+            ->findBy([ ], [ 'createdAt' => 'DESC' ]);
92 92
 
93
-        $form_delete = [];
93
+        $form_delete = [ ];
94 94
 
95 95
         foreach ($module as $item) {
96
-            $form_delete[$item->getId()] = $this->createFormDelete($item->getId())->createView();
96
+            $form_delete[ $item->getId() ] = $this->createFormDelete($item->getId())->createView();
97 97
         }
98 98
 
99 99
         return [
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     private function createFormDelete($id)
110 110
     {
111 111
         return $this->createFormBuilder()
112
-            ->setAction($this->generateUrl('remove_module', ['id' => $id]))
112
+            ->setAction($this->generateUrl('remove_module', [ 'id' => $id ]))
113 113
             ->setMethod('DELETE')
114 114
             ->add('submit', SubmitType::class, [
115 115
                 'label' => ' ',
Please login to merge, or discard this patch.
src/AppBundle/Controller/Admin/InfoPassModulesController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@
 block discarded – undo
26 26
             $modulesUser = $em->getRepository('AppBundle:ModuleUser')
27 27
                 ->findInfoPassModules($module);
28 28
 
29
-            return new Response(json_encode(['modulesUser' => $modulesUser]));
29
+            return new Response(json_encode([ 'modulesUser' => $modulesUser ]));
30 30
         }
31 31
 
32 32
 
33
-        return ['modules' => $allmodules];
33
+        return [ 'modules' => $allmodules ];
34 34
     }
35 35
 }
Please login to merge, or discard this patch.
src/AppBundle/Controller/Admin/ModuleUserController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
         $user = $em->getRepository('AppBundle:User')
28 28
             ->find($idUser);
29 29
         $modulesUser = $em->getRepository('AppBundle:ModuleUser')
30
-            ->findBy(['user' => $user]);
30
+            ->findBy([ 'user' => $user ]);
31 31
 
32 32
         $moduleUser = new ModuleUser();
33
-        $form = $this->createForm(ModuleUserType::class, $moduleUser, ['user' => $user]);
33
+        $form = $this->createForm(ModuleUserType::class, $moduleUser, [ 'user' => $user ]);
34 34
 
35 35
         $form->handleRequest($request);
36 36
 
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
             return $this->redirectToRoute('user_show');
44 44
         }
45 45
 
46
-        $form_delete = [];
46
+        $form_delete = [ ];
47 47
 
48 48
         foreach ($modulesUser as $item) {
49
-            $form_delete[$item->getModule()->getId()] = $this->createFormDelete($idUser, $item->getModule()->getId())->createView();
49
+            $form_delete[ $item->getModule()->getId() ] = $this->createFormDelete($idUser, $item->getModule()->getId())->createView();
50 50
         }
51 51
 
52 52
         return [
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
         $module = $em->getRepository('AppBundle:Module')
69 69
             ->find($idModule);
70 70
         $moduleUser = $em->getRepository('AppBundle:ModuleUser')
71
-            ->findOneBy(['user' => $user, 'module' => $module]);
71
+            ->findOneBy([ 'user' => $user, 'module' => $module ]);
72 72
 
73 73
         $em->remove($moduleUser);
74 74
         $em->flush();
75 75
 
76
-        return $this->redirectToRoute('create_moduleUser', ['idUser' => $idUser]);
76
+        return $this->redirectToRoute('create_moduleUser', [ 'idUser' => $idUser ]);
77 77
     }
78 78
 
79 79
     /**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     private function createFormDelete($idUser, $idModule)
83 83
     {
84 84
         return $this->createFormBuilder()
85
-            ->setAction($this->generateUrl('remove_moduleUser', ['idUser' => $idUser, 'idModule' => $idModule]))
85
+            ->setAction($this->generateUrl('remove_moduleUser', [ 'idUser' => $idUser, 'idModule' => $idModule ]))
86 86
             ->setMethod('DELETE')
87 87
             ->add('submit', SubmitType::class, [
88 88
                 'label' => ' ',
Please login to merge, or discard this patch.
src/AppBundle/Controller/Admin/AdminController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,6 +18,6 @@
 block discarded – undo
18 18
      */
19 19
     public function indexAction()
20 20
     {
21
-        return [];
21
+        return [ ];
22 22
     }
23 23
 }
Please login to merge, or discard this patch.
src/AppBundle/Controller/Admin/CategoryController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             return $this->redirectToRoute('show_category');
38 38
         }
39 39
 
40
-        return ['form' => $form->createView()];
40
+        return [ 'form' => $form->createView() ];
41 41
     }
42 42
 
43 43
     /**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
             return $this->redirectToRoute('show_category');
61 61
         }
62 62
 
63
-        return ['form' => $form->createView()];
63
+        return [ 'form' => $form->createView() ];
64 64
     }
65 65
 
66 66
     /**
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
         $em = $this->getDoctrine()->getManager();
91 91
 
92 92
         $category = $em->getRepository('AppBundle:Category')
93
-            ->findBy([], ['title' => 'ASC']);
93
+            ->findBy([ ], [ 'title' => 'ASC' ]);
94 94
 
95
-        $form_delete = [];
95
+        $form_delete = [ ];
96 96
 
97 97
         foreach ($category as $item) {
98
-            $form_delete[$item->getId()] = $this->createFormDelete($item->getId())->createView();
98
+            $form_delete[ $item->getId() ] = $this->createFormDelete($item->getId())->createView();
99 99
         }
100 100
 
101 101
         return [
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     private function createFormDelete($id)
112 112
     {
113 113
         return $this->createFormBuilder()
114
-            ->setAction($this->generateUrl('remove_category', ['id' => $id]))
114
+            ->setAction($this->generateUrl('remove_category', [ 'id' => $id ]))
115 115
             ->setMethod('DELETE')
116 116
             ->add('submit', SubmitType::class, [
117 117
                 'label' => ' ',
Please login to merge, or discard this patch.
src/AppBundle/Controller/Account/AccountController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
             $moduleAjax = $em->getRepository('AppBundle:PassModule')
27 27
                 ->findAjax($module);
28 28
 
29
-            return new Response(json_encode(['moduleAjax' => $moduleAjax]));
29
+            return new Response(json_encode([ 'moduleAjax' => $moduleAjax ]));
30 30
         }
31 31
 
32 32
         $modules = $em->getRepository('AppBundle:ModuleUser')
Please login to merge, or discard this patch.
src/AppBundle/Controller/PassingTestController.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
         $passManager = $this->container->get('app.pass_manager');
38 38
         $result = $passManager->passModule($idPass);
39 39
 
40
-        if($result['status'] == 'ok' && $request->isMethod('POST')){
41
-                $form = $result['content'][0];
40
+        if ($result[ 'status' ] == 'ok' && $request->isMethod('POST')) {
41
+                $form = $result[ 'content' ][ 0 ];
42 42
                 $form->bind($request);
43 43
                 $data = $form->getData();
44 44
                 $result = $this->get('app.pass_control')->process($data);
@@ -54,29 +54,29 @@  discard block
 block discarded – undo
54 54
     public function passResultAction(Request $request, $idPass)
55 55
     {
56 56
         $passModule = $this->getDoctrine()->getRepository('AppBundle:PassModule')
57
-                        ->getDonePassModuleByIdAndUser($idPass,$this->getUser()->getId())
57
+                        ->getDonePassModuleByIdAndUser($idPass, $this->getUser()->getId())
58 58
                         ;
59 59
 
60
-        if($passModule === null)
60
+        if ($passModule === null)
61 61
             throw new HttpException(403, 'You don\'t have permission for look this data');
62 62
 
63
-        if($passModule->getStateResult() === PassModule::STATE_EXPIRED)
63
+        if ($passModule->getStateResult() === PassModule::STATE_EXPIRED)
64 64
             throw new HttpException(403, 'This pass expired.');
65 65
 
66
-        return ['passModule' => $passModule];
66
+        return [ 'passModule' => $passModule ];
67 67
     }
68 68
 
69 69
 
70
-    private function processResult($result){
71
-        switch ($result['status']) {
70
+    private function processResult($result) {
71
+        switch ($result[ 'status' ]) {
72 72
             case 'redirect_to_pass':
73
-                return $this->redirectToRoute('pass_module',['idPass' => $result['content']], $result['code']);
73
+                return $this->redirectToRoute('pass_module', [ 'idPass' => $result[ 'content' ] ], $result[ 'code' ]);
74 74
             case 'redirect_to_result':
75
-                return $this->redirectToRoute('pass_result',['idPass' => $result['content']], $result['code']);
75
+                return $this->redirectToRoute('pass_result', [ 'idPass' => $result[ 'content' ] ], $result[ 'code' ]);
76 76
             case 'error':
77
-                throw new HttpException($result['code'], $result['content']);
77
+                throw new HttpException($result[ 'code' ], $result[ 'content' ]);
78 78
             case 'ok':
79
-                list($form, $question, $time_residue, $countQuestions, $currentNumberQuestion) = $result['content'];
79
+                list($form, $question, $time_residue, $countQuestions, $currentNumberQuestion) = $result[ 'content' ];
80 80
                 return [
81 81
                     'data' => [
82 82
                         'form' => $form->createView(),
Please login to merge, or discard this 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/Admin/AdminInfoUsersController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
             $moduleAjax = $em->getRepository('AppBundle:PassModule')
27 27
                 ->findAjax($module);
28 28
 
29
-            return new Response(json_encode(['moduleAjax' => $moduleAjax]));
29
+            return new Response(json_encode([ 'moduleAjax' => $moduleAjax ]));
30 30
         }
31 31
 
32 32
         $modules = $em->getRepository('AppBundle:ModuleUser')
Please login to merge, or discard this patch.