@@ -16,7 +16,7 @@ |
||
| 16 | 16 | |
| 17 | 17 | $locales = $router->getRouteCollection()->get('obblm_locale_switch')->getRequirement('_locale'); |
| 18 | 18 | |
| 19 | - if($locales) { |
|
| 19 | + if ($locales) { |
|
| 20 | 20 | $this->available_locales = explode('|', $locales); |
| 21 | 21 | } |
| 22 | 22 | } |
@@ -23,10 +23,10 @@ |
||
| 23 | 23 | parent::execute($input, $output); |
| 24 | 24 | $this->io->title('Promote a new OBBLM Administrator'); |
| 25 | 25 | $this->io->caution('Be carefull, this new user will have the highest right on the application'); |
| 26 | - if($this->confirmContinue()) { |
|
| 26 | + if ($this->confirmContinue()) { |
|
| 27 | 27 | $coach = $this->getCoachByLoginOrEmail(); |
| 28 | 28 | $continue = $this->io->confirm("Are you sure you want to promote {$coach->getUsername()} ?", true); |
| 29 | - if($continue) { |
|
| 29 | + if ($continue) { |
|
| 30 | 30 | $coach |
| 31 | 31 | ->setRoles([Roles::ADMIN]); |
| 32 | 32 | $this->saveCoach($coach); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | protected function askUsername():string |
| 56 | 56 | { |
| 57 | 57 | $coachRepository = $this->em->getRepository(Coach::class); |
| 58 | - return $this->io->ask('User login', null, function ($username) use ($coachRepository) { |
|
| 58 | + return $this->io->ask('User login', null, function($username) use ($coachRepository) { |
|
| 59 | 59 | if (empty($username)) { |
| 60 | 60 | throw new \RuntimeException('The login cannot be empty.'); |
| 61 | 61 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | protected function askEmail():string |
| 70 | 70 | { |
| 71 | 71 | $coachRepository = $this->em->getRepository(Coach::class); |
| 72 | - return $this->io->ask('User email', null, function ($email) use ($coachRepository) { |
|
| 72 | + return $this->io->ask('User email', null, function($email) use ($coachRepository) { |
|
| 73 | 73 | if (empty($email)) { |
| 74 | 74 | throw new \RuntimeException('The email cannot be empty.'); |
| 75 | 75 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | protected function askPassword():string |
| 84 | 84 | { |
| 85 | - $password = $this->io->askHidden('User password', function ($password) { |
|
| 85 | + $password = $this->io->askHidden('User password', function($password) { |
|
| 86 | 86 | if (empty($password)) { |
| 87 | 87 | throw new \RuntimeException('Password cannot be empty.'); |
| 88 | 88 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | $choice = $this->io->choice('Search him by login or email ', ['login', 'email']); |
| 104 | 104 | |
| 105 | - if($choice !== 'login' && $choice !== 'email') { |
|
| 105 | + if ($choice !== 'login' && $choice !== 'email') { |
|
| 106 | 106 | throw new \RuntimeException("Something went wrong."); |
| 107 | 107 | return 0; |
| 108 | 108 | } |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | $choice = $this->getChoice(); |
| 116 | 116 | |
| 117 | 117 | $coachRepository = $this->em->getRepository(Coach::class); |
| 118 | - if($choice === 'login') { |
|
| 119 | - return $this->io->ask('User login', null, function ($username) use ($coachRepository) { |
|
| 118 | + if ($choice === 'login') { |
|
| 119 | + return $this->io->ask('User login', null, function($username) use ($coachRepository) { |
|
| 120 | 120 | if (empty($username)) { |
| 121 | 121 | throw new \RuntimeException('The login cannot be empty.'); |
| 122 | 122 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | return $coach; |
| 128 | 128 | }); |
| 129 | 129 | } |
| 130 | - return $this->io->ask('User email', null, function ($email) use ($coachRepository) { |
|
| 130 | + return $this->io->ask('User email', null, function($email) use ($coachRepository) { |
|
| 131 | 131 | if (empty($email)) { |
| 132 | 132 | throw new \RuntimeException('The email cannot be empty.'); |
| 133 | 133 | } |
@@ -24,13 +24,13 @@ |
||
| 24 | 24 | |
| 25 | 25 | $this->io->title('Revoke an OBBLM Administrator'); |
| 26 | 26 | $this->io->caution('Be carefull, this new user will not have anymore the highest right on the application'); |
| 27 | - if($this->confirmContinue()) { |
|
| 27 | + if ($this->confirmContinue()) { |
|
| 28 | 28 | |
| 29 | 29 | $coach = $this->getCoachByLoginOrEmail(); |
| 30 | 30 | |
| 31 | 31 | $continue = $this->io->confirm("Are you sure you want to revoke {$coach->getUsername()} ?", true); |
| 32 | - if($continue) { |
|
| 33 | - if(in_array(Roles::ADMIN, $coach->getRoles())) { |
|
| 32 | + if ($continue) { |
|
| 33 | + if (in_array(Roles::ADMIN, $coach->getRoles())) { |
|
| 34 | 34 | $coach |
| 35 | 35 | ->setRoles([Roles::COACH]); |
| 36 | 36 | $this->saveCoach($coach); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $this->io->title('Create a new OBBLM Administrator'); |
| 23 | 23 | $this->io->caution('Be carefull, this new user will have the highest right on the application'); |
| 24 | 24 | |
| 25 | - if($this->confirmContinue()) { |
|
| 25 | + if ($this->confirmContinue()) { |
|
| 26 | 26 | |
| 27 | 27 | $this->io->section('User informations'); |
| 28 | 28 | $username = $this->askUsername(); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | ->setLocale('en') |
| 39 | 39 | ->setRoles([Roles::ADMIN]) |
| 40 | 40 | ; |
| 41 | - if(!$active) { |
|
| 41 | + if (!$active) { |
|
| 42 | 42 | $coach |
| 43 | 43 | ->setHash(hash('sha256', $coach->getEmail())); |
| 44 | 44 | $registration = new RegisterCoachEvent($coach); |
@@ -13,6 +13,6 @@ |
||
| 13 | 13 | |
| 14 | 14 | public function validatedBy() |
| 15 | 15 | { |
| 16 | - return get_class($this).'Validator'; |
|
| 16 | + return get_class($this) . 'Validator'; |
|
| 17 | 17 | } |
| 18 | 18 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | public function localeSwitch(Request $request) |
| 32 | 32 | { |
| 33 | - if($request->headers->get('referer')) |
|
| 33 | + if ($request->headers->get('referer')) |
|
| 34 | 34 | { |
| 35 | 35 | return $this->redirect($request->headers->get('referer')); |
| 36 | 36 | } |
@@ -138,13 +138,13 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | $form->handleRequest($request); |
| 140 | 140 | |
| 141 | - if($form->isSubmitted() && $form->isValid()) |
|
| 141 | + if ($form->isSubmitted() && $form->isValid()) |
|
| 142 | 142 | { |
| 143 | 143 | $data = $form->getData(); |
| 144 | 144 | $em = $this->getDoctrine()->getManager(); |
| 145 | 145 | /** @var Coach $coach */ |
| 146 | 146 | $coach = $em->getRepository(Coach::class)->findOneByEmail($data['email']); |
| 147 | - if($coach) { |
|
| 147 | + if ($coach) { |
|
| 148 | 148 | $coach |
| 149 | 149 | ->setResetPasswordAt(new \DateTime()) |
| 150 | 150 | ->setResetPasswordHash($this->getHashFor(random_bytes(10))); |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | /** @var Coach $coach */ |
| 177 | 177 | $coach = $em->getRepository(Coach::class)->findOneForPasswordReset($hash); |
| 178 | 178 | |
| 179 | - if($coach) { |
|
| 179 | + if ($coach) { |
|
| 180 | 180 | $form = $this->createForm(PasswordConfirmType::class); |
| 181 | 181 | |
| 182 | 182 | $form->handleRequest($request); |