@@ -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 | } |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Created by PhpStorm. |
|
4 | - * User: device |
|
5 | - * Date: 18.03.16 |
|
6 | - * Time: 18:52 |
|
7 | - */ |
|
3 | + * Created by PhpStorm. |
|
4 | + * User: device |
|
5 | + * Date: 18.03.16 |
|
6 | + * Time: 18:52 |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | namespace AppBundle\Tests\Controller\Admin; |
10 | 10 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | 'PHP_AUTH_USER' => '[email protected]', |
50 | 50 | 'PHP_AUTH_PW' => 'user', |
51 | 51 | )); |
52 | - $client->request('GET', '/admin/question/show/1'); |
|
52 | + $client->request('GET', '/admin/question/show/1'); |
|
53 | 53 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
54 | 54 | } |
55 | 55 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $email = trim($request->get('email')); |
105 | 105 | |
106 | 106 | $user = $em->getRepository('AppBundle:User') |
107 | - ->findOneBy(['email' => $email]); |
|
107 | + ->findOneBy([ 'email' => $email ]); |
|
108 | 108 | |
109 | 109 | if ($user && $user->getIsReg() == true) { |
110 | 110 | $password = $this->get('app.custom.mailer')->sendMailRecovery($email); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | return $this->redirectToRoute('homepage'); |
128 | 128 | } else { |
129 | 129 | |
130 | - return []; |
|
130 | + return [ ]; |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | } |
@@ -72,24 +72,24 @@ |
||
72 | 72 | */ |
73 | 73 | public function checkUserHash($hash, $email) |
74 | 74 | { |
75 | - $em = $this->getDoctrine()->getManager(); |
|
75 | + $em = $this->getDoctrine()->getManager(); |
|
76 | 76 | |
77 | - $user = $em->getRepository('AppBundle:User') |
|
78 | - ->findOneBy(array('email' => $email, 'hash' => $hash)); |
|
77 | + $user = $em->getRepository('AppBundle:User') |
|
78 | + ->findOneBy(array('email' => $email, 'hash' => $hash)); |
|
79 | 79 | |
80 | - if ($user) { |
|
81 | - $user->setIsActive(true); |
|
82 | - $user->setHash(null); |
|
83 | - $this->addFlash('notice', 'You have successfully passed registration confirmation'); |
|
80 | + if ($user) { |
|
81 | + $user->setIsActive(true); |
|
82 | + $user->setHash(null); |
|
83 | + $this->addFlash('notice', 'You have successfully passed registration confirmation'); |
|
84 | 84 | |
85 | - $em->flush(); |
|
85 | + $em->flush(); |
|
86 | 86 | |
87 | - return $this->redirectToRoute('homepage'); |
|
88 | - } |
|
87 | + return $this->redirectToRoute('homepage'); |
|
88 | + } |
|
89 | 89 | |
90 | - $this->addFlash('notice', 'You haven\'t passed registration confirmation'); |
|
90 | + $this->addFlash('notice', 'You haven\'t passed registration confirmation'); |
|
91 | 91 | |
92 | - return $this->redirectToRoute('homepage'); |
|
92 | + return $this->redirectToRoute('homepage'); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Created by PhpStorm. |
|
4 | - * User: device |
|
5 | - * Date: 20.03.16 |
|
6 | - * Time: 10:40 |
|
7 | - */ |
|
3 | + * Created by PhpStorm. |
|
4 | + * User: device |
|
5 | + * Date: 20.03.16 |
|
6 | + * Time: 10:40 |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | namespace AppBundle\Services; |
10 | 10 |
@@ -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')); |
|
17 | + $array = array_merge(range('A', 'Z'), range('a', 'z'), range('0', '9')); |
|
18 | 18 | $c = count($array); |
19 | - for($i = 0; $i < 6; $i++) { |
|
20 | - $key .= $array[rand(0, $c)]; |
|
19 | + for ($i = 0; $i < 6; $i++) { |
|
20 | + $key .= $array[ rand(0, $c) ]; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | return $key; |
@@ -38,8 +38,8 @@ |
||
38 | 38 | 'class' => 'form-control', |
39 | 39 | ] |
40 | 40 | ], |
41 | - 'first_options' => ['label' => 'Password'], |
|
42 | - 'second_options' => ['label' => 'Repeat Password'], |
|
41 | + 'first_options' => [ 'label' => 'Password' ], |
|
42 | + 'second_options' => [ 'label' => 'Repeat Password' ], |
|
43 | 43 | ] |
44 | 44 | ); |
45 | 45 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | */ |
267 | 267 | public function getRoles() |
268 | 268 | { |
269 | - return [$this->role]; |
|
269 | + return [ $this->role ]; |
|
270 | 270 | |
271 | 271 | } |
272 | 272 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | */ |
321 | 321 | public function isAccountNonLocked() |
322 | 322 | { |
323 | - return $this->isLocked ? false : true ; |
|
323 | + return $this->isLocked ? false : true; |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Created by PhpStorm. |
|
4 | - * User: device |
|
5 | - * Date: 23.02.16 |
|
6 | - * Time: 9:44 |
|
7 | - */ |
|
3 | + * Created by PhpStorm. |
|
4 | + * User: device |
|
5 | + * Date: 23.02.16 |
|
6 | + * Time: 9:44 |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | namespace AppBundle\Entity; |
10 | 10 |