@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function indexAction() |
22 | 22 | { |
23 | - return []; |
|
23 | + return [ ]; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $moduleAjax = $em->getRepository('AppBundle:PassModule') |
36 | 36 | ->findAjax($module); |
37 | 37 | |
38 | - return new Response(json_encode(['moduleAjax' => $moduleAjax])); |
|
38 | + return new Response(json_encode([ 'moduleAjax' => $moduleAjax ])); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
@@ -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 | } |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | $passManager = $this->container->get('app.pass_manager'); |
42 | 42 | $result = $passManager->passModule($idPass); |
43 | 43 | |
44 | - if($result['status'] == 'ok' && $request->isMethod('POST')){ |
|
45 | - $form = $result['content'][0]; |
|
44 | + if ($result[ 'status' ] == 'ok' && $request->isMethod('POST')) { |
|
45 | + $form = $result[ 'content' ][ 0 ]; |
|
46 | 46 | $form->bind($request); |
47 | 47 | $data = $form->getData(); |
48 | 48 | $result = $this->get('app.pass_control')->process($data); |
@@ -58,29 +58,29 @@ discard block |
||
58 | 58 | public function passResultAction(Request $request, $idPass) |
59 | 59 | { |
60 | 60 | $passModule = $this->getDoctrine()->getRepository('AppBundle:PassModule') |
61 | - ->getDonePassModuleByIdAndUser($idPass,$this->getUser()->getId()) |
|
61 | + ->getDonePassModuleByIdAndUser($idPass, $this->getUser()->getId()) |
|
62 | 62 | ; |
63 | 63 | |
64 | - if($passModule === null) |
|
64 | + if ($passModule === null) |
|
65 | 65 | throw new HttpException(403, 'You don\'t have permission for look this data'); |
66 | 66 | |
67 | - if($passModule->getStateResult() === PassModule::STATE_EXPIRED) |
|
67 | + if ($passModule->getStateResult() === PassModule::STATE_EXPIRED) |
|
68 | 68 | throw new HttpException(403, 'This pass expired.'); |
69 | 69 | |
70 | - return ['passModule' => $passModule]; |
|
70 | + return [ 'passModule' => $passModule ]; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
74 | - private function processResult($result){ |
|
75 | - switch ($result['status']) { |
|
74 | + private function processResult($result) { |
|
75 | + switch ($result[ 'status' ]) { |
|
76 | 76 | case 'redirect_to_pass': |
77 | - return $this->redirectToRoute('pass_module',['idPass' => $result['content']], $result['code']); |
|
77 | + return $this->redirectToRoute('pass_module', [ 'idPass' => $result[ 'content' ] ], $result[ 'code' ]); |
|
78 | 78 | case 'redirect_to_result': |
79 | - return $this->redirectToRoute('pass_result',['idPass' => $result['content']], $result['code']); |
|
79 | + return $this->redirectToRoute('pass_result', [ 'idPass' => $result[ 'content' ] ], $result[ 'code' ]); |
|
80 | 80 | case 'error': |
81 | - throw new HttpException($result['code'], $result['content']); |
|
81 | + throw new HttpException($result[ 'code' ], $result[ 'content' ]); |
|
82 | 82 | case 'ok': |
83 | - list($form, $question, $time_residue, $countQuestions, $currentNumberQuestion, $module) = $result['content']; |
|
83 | + list($form, $question, $time_residue, $countQuestions, $currentNumberQuestion, $module) = $result[ 'content' ]; |
|
84 | 84 | return [ |
85 | 85 | 'data' => [ |
86 | 86 | 'form' => $form->createView(), |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Created by PhpStorm. |
|
4 | - * User: device |
|
5 | - * Date: 23.02.16 |
|
6 | - * Time: 10:00 |
|
7 | - */ |
|
3 | + * Created by PhpStorm. |
|
4 | + * User: device |
|
5 | + * Date: 23.02.16 |
|
6 | + * Time: 10:00 |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | namespace AppBundle\Entity; |
10 | 10 |
@@ -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')); |
|
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; |
@@ -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 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $users = $em->getRepository('AppBundle:User') |
27 | 27 | ->findChoiceModules($module); |
28 | 28 | |
29 | - return new Response(json_encode(['users' => $users])); |
|
29 | + return new Response(json_encode([ 'users' => $users ])); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | if ($choice = $request->get('users_choice')) { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $moduleUser = new ModuleUser(); |
39 | 39 | $moduleUser->setModule($moduleHidden); |
40 | 40 | $user = $em->getRepository('AppBundle:User') |
41 | - ->find($choice[$i]); |
|
41 | + ->find($choice[ $i ]); |
|
42 | 42 | $moduleUser->setUser($user); |
43 | 43 | $user->removeChosenModule($hiddenModule); |
44 | 44 | $em->persist($moduleUser); |
@@ -43,8 +43,9 @@ |
||
43 | 43 | public function afterSocLogin() |
44 | 44 | { |
45 | 45 | $user = $this->getUser(); |
46 | - if (!$user->getPassword()) |
|
47 | - return $this->redirectToRoute('update_profile'); |
|
46 | + if (!$user->getPassword()) { |
|
47 | + return $this->redirectToRoute('update_profile'); |
|
48 | + } |
|
48 | 49 | |
49 | 50 | return $this->redirectToRoute('account'); |
50 | 51 | } |
@@ -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()); |
@@ -24,7 +24,7 @@ |
||
24 | 24 | { |
25 | 25 | return $this->createQueryBuilder('u') |
26 | 26 | ->where('u.chosenModule LIKE :module') |
27 | - ->setParameter('module', '%"'.$module.'"%') |
|
27 | + ->setParameter('module', '%"' . $module . '"%') |
|
28 | 28 | ->getQuery() |
29 | 29 | ->getResult(); |
30 | 30 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | ->andWhere('user.role <> :role') |
18 | 18 | ->setParameter('role', $role) |
19 | 19 | ->getQuery() |
20 | - // ->getResult() |
|
20 | + // ->getResult() |
|
21 | 21 | ; |
22 | 22 | } |
23 | 23 |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $this->isLocked = false; |
128 | 128 | $this->modulesUser = new ArrayCollection(); |
129 | 129 | $this->role = self::ROLE_USER; |
130 | - $this->chosenModule = []; |
|
130 | + $this->chosenModule = [ ]; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | */ |
268 | 268 | public function getRoles() |
269 | 269 | { |
270 | - return [$this->role]; |
|
270 | + return [ $this->role ]; |
|
271 | 271 | |
272 | 272 | } |
273 | 273 | |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | */ |
322 | 322 | public function isAccountNonLocked() |
323 | 323 | { |
324 | - return $this->isLocked ? false : true ; |
|
324 | + return $this->isLocked ? false : true; |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
@@ -491,8 +491,8 @@ discard block |
||
491 | 491 | |
492 | 492 | public function removeChosenModule($chosenModule) |
493 | 493 | { |
494 | - if(($key = array_search($chosenModule, $this->chosenModule)) !== false) { |
|
495 | - unset($this->chosenModule[$key]); |
|
494 | + if (($key = array_search($chosenModule, $this->chosenModule)) !== false) { |
|
495 | + unset($this->chosenModule[ $key ]); |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | return $this; |