@@ -77,7 +77,7 @@ |
||
| 77 | 77 | |
| 78 | 78 | return $this->templating->renderResponse( |
| 79 | 79 | '@FlyingColoursTwilioTwoFactor/trigger/default.html.twig', |
| 80 | - [ 'form' => $this->form->createView() ] |
|
| 80 | + ['form' => $this->form->createView()] |
|
| 81 | 81 | ); |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -13,9 +13,9 @@ discard block |
||
| 13 | 13 | { |
| 14 | 14 | $config = $this->processConfiguration(new Configuration(), $configs); |
| 15 | 15 | |
| 16 | - foreach($config as $l1 => $val1) |
|
| 16 | + foreach ($config as $l1 => $val1) |
|
| 17 | 17 | { |
| 18 | - if(is_array($val1)) |
|
| 18 | + if (is_array($val1)) |
|
| 19 | 19 | { |
| 20 | 20 | foreach ($val1 as $l2 => $val2) |
| 21 | 21 | { |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | $loader = new Loader\YamlFileLoader( |
| 33 | 33 | $container, |
| 34 | - new FileLocator(__DIR__ . '/../Resources/config') |
|
| 34 | + new FileLocator(__DIR__.'/../Resources/config') |
|
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | 37 | $loader->load('services.yml'); |
@@ -21,8 +21,7 @@ |
||
| 21 | 21 | { |
| 22 | 22 | $container->setParameter(sprintf('flying_colours_twilio_two_factor.%s.%s', $l1, $l2), $val2); |
| 23 | 23 | } |
| 24 | - } |
|
| 25 | - else |
|
| 24 | + } else |
|
| 26 | 25 | { |
| 27 | 26 | $container->setParameter(sprintf('flying_colours_twilio_two_factor.%s', $l1), $val1); |
| 28 | 27 | } |
@@ -55,12 +55,12 @@ |
||
| 55 | 55 | |
| 56 | 56 | public function validateAuthenticationCode($user, string $authenticationCode): bool |
| 57 | 57 | { |
| 58 | - if ( ! $user instanceof Twilio\TwoFactorInterface || ! $this->session->has('twilio_code')) |
|
| 58 | + if (!$user instanceof Twilio\TwoFactorInterface || !$this->session->has('twilio_code')) |
|
| 59 | 59 | { |
| 60 | 60 | return false; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - if(hash_equals($this->session->get('twilio_code'), $authenticationCode)) |
|
| 63 | + if (hash_equals($this->session->get('twilio_code'), $authenticationCode)) |
|
| 64 | 64 | { |
| 65 | 65 | $this->session->remove('twilio_code'); |
| 66 | 66 | return true; |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | |
| 22 | 22 | public function buildForm(FormBuilderInterface $builder, array $options) |
| 23 | 23 | { |
| 24 | - $methods = [ 'sms', 'call' ]; |
|
| 24 | + $methods = ['sms', 'call']; |
|
| 25 | 25 | |
| 26 | 26 | $builder |
| 27 | 27 | ->add('twilioPreferredMethod', ChoiceType::class, [ |
@@ -8,5 +8,5 @@ |
||
| 8 | 8 | |
| 9 | 9 | public function getTwilioPreferredMethod(): ?string; |
| 10 | 10 | |
| 11 | - public function getTwilioPhoneNumber(): ?string ; |
|
| 11 | + public function getTwilioPhoneNumber(): ?string; |
|
| 12 | 12 | } |
| 13 | 13 | \ No newline at end of file |
@@ -37,7 +37,9 @@ discard block |
||
| 37 | 37 | $this->session = $session; |
| 38 | 38 | $this->config = $config; |
| 39 | 39 | |
| 40 | - if($request) $this->host = $request->getHost(); |
|
| 40 | + if($request) { |
|
| 41 | + $this->host = $request->getHost(); |
|
| 42 | + } |
|
| 41 | 43 | } |
| 42 | 44 | |
| 43 | 45 | public static function getSubscribedEvents() |
@@ -64,8 +66,7 @@ discard block |
||
| 64 | 66 | 'body' => preg_replace('/{code}/', $code, $this->config['sms_message']) |
| 65 | 67 | ] |
| 66 | 68 | ); |
| 67 | - } |
|
| 68 | - else |
|
| 69 | + } else |
|
| 69 | 70 | { |
| 70 | 71 | if ( ! $this->config['voice_message_url'] && $this->host) |
| 71 | 72 | { |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | $this->session = $session; |
| 38 | 38 | $this->config = $config; |
| 39 | 39 | |
| 40 | - if($request) $this->host = $request->getHost(); |
|
| 40 | + if ($request) $this->host = $request->getHost(); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public static function getSubscribedEvents() |
| 44 | 44 | { |
| 45 | - return [ 'twilio.auth.triggered' => 'onTwilioAuthTriggered' ]; |
|
| 45 | + return ['twilio.auth.triggered' => 'onTwilioAuthTriggered']; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public function onTwilioAuthTriggered(GenericEvent $event) |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | $this->session->set('twilio_code', (string) $code); |
| 58 | 58 | |
| 59 | - if($user->getTwilioPreferredMethod() == 'sms') |
|
| 59 | + if ($user->getTwilioPreferredMethod() == 'sms') |
|
| 60 | 60 | { |
| 61 | 61 | $this->client->messages->create( |
| 62 | 62 | $user->getTwilioPhoneNumber(), [ |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | else |
| 69 | 69 | { |
| 70 | - if ( ! $this->config['voice_message_url'] && $this->host) |
|
| 70 | + if (!$this->config['voice_message_url'] && $this->host) |
|
| 71 | 71 | { |
| 72 | 72 | $this->config['voice_message_url'] = sprintf('http://%s/voice-ctrl?code={code}', $this->host); |
| 73 | 73 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $this->client->account->calls->create( |
| 76 | 76 | $user->getTwilioPhoneNumber(), |
| 77 | 77 | $this->config['voice_from'], |
| 78 | - [ 'url' => preg_replace('/{code}/', $code, $this->config['voice_message_url']) ] |
|
| 78 | + ['url' => preg_replace('/{code}/', $code, $this->config['voice_message_url'])] |
|
| 79 | 79 | ); |
| 80 | 80 | } |
| 81 | 81 | } |