@@ -37,7 +37,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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' => ' ', |
@@ -26,7 +26,7 @@ |
||
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') |
@@ -37,8 +37,8 @@ discard block |
||
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 |
||
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(), |
@@ -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 | } |