Completed
Pull Request — master (#904)
by Paweł
11:37
created
src/SWP/Bundle/CoreBundle/Security/Provider/ExternalOauthProvider.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     }
23 23
 
24 24
     public function getAccessToken($grant, $options = []) {
25
-        if(!isset($this->access_token)) {
25
+        if (!isset($this->access_token)) {
26 26
             $this->access_token = parent::getAccessToken($grant, $options);
27 27
         }
28 28
         return $this->access_token;
@@ -30,17 +30,17 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function getBaseAuthorizationUrl()
32 32
     {
33
-        return $this->base_url . '/authorize';
33
+        return $this->base_url.'/authorize';
34 34
     }
35 35
 
36 36
     public function getBaseAccessTokenUrl(array $params)
37 37
     {
38
-        return $this->base_url . '/oauth/token';
38
+        return $this->base_url.'/oauth/token';
39 39
     }
40 40
 
41 41
     public function getResourceOwnerDetailsUrl(AccessToken $token)
42 42
     {
43
-        return $this->base_url . '/userinfo';
43
+        return $this->base_url.'/userinfo';
44 44
     }
45 45
 
46 46
     protected function getDefaultScopes()
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
     protected function checkResponse(ResponseInterface $response, $data)
52 52
     {
53
-        if($response->getStatusCode() >= 400) {
53
+        if ($response->getStatusCode() >= 400) {
54 54
             return new IdentityProviderException(
55 55
                 $response->getReasonPhrase(),
56 56
                 $response->getStatusCode(),
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 
71 71
     protected function getAuthorizationHeaders($token = null)
72 72
     {
73
-        if($token) {
73
+        if ($token) {
74 74
             return [
75
-                'Authorization' => 'Bearer ' . $token
75
+                'Authorization' => 'Bearer '.$token
76 76
             ];
77 77
         } else {
78 78
             return [];
Please login to merge, or discard this patch.
SWP/Bundle/CoreBundle/Security/Authenticator/ExternalOauthAuthenticator.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function supports(Request $request) 
52 52
     {
53
-        if(!$this->security->getUser() || ($request->query->get('code') && $request->get('state'))) {
53
+        if (!$this->security->getUser() || ($request->query->get('code') && $request->get('state'))) {
54 54
             return true;
55 55
         }
56 56
 
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
         $oauthEmail = $oauthUser->getEmail();
80 80
         $oauthId = $oauthUser->getId();
81 81
 
82
-        if(!$oauthUser) {
82
+        if (!$oauthUser) {
83 83
             return null;
84 84
         }
85 85
 
86 86
         // Is there an existing user with the same oauth id?
87 87
         $user = $userProvider->findOneByExternalId($oauthId);
88
-        if($user) {
89
-            if($user->getEmail() !== $oauthEmail) {
88
+        if ($user) {
89
+            if ($user->getEmail() !== $oauthEmail) {
90 90
                 // If the email has changed for the user, update it here as well
91 91
                 $user->setEmail($oauthEmail);
92 92
                 $user->setUsername($oauthEmail);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
         // Is there an existing user with the same email address?
100 100
         $user = $userProvider->findOneByEmail($oauthEmail);
101
-        if($user) {
101
+        if ($user) {
102 102
             return $user;
103 103
         }
104 104
 
Please login to merge, or discard this patch.