Completed
Push — master ( a51466...8daf75 )
by Raffael
02:47
created
src/Auth.php 3 patches
Doc Comments   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      * Set options
77 77
      *
78 78
      * @param  Iterable $config
79
-     * @return Log
79
+     * @return Auth
80 80
      */
81 81
     public function setOptions(?Iterable $config=null): Auth
82 82
     {
@@ -210,7 +210,6 @@  discard block
 block discarded – undo
210 210
     /**
211 211
      * Authenticate
212 212
      *
213
-     * @param   Iterable $adapters
214 213
      * @return  bool
215 214
      */
216 215
     public function requireOne(): bool
@@ -252,7 +251,7 @@  discard block
 block discarded – undo
252 251
     /**
253 252
      * Get identity
254 253
      *
255
-     * @return identity
254
+     * @return Identity
256 255
      */
257 256
     public function getIdentity(): Identity
258 257
     {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -242,7 +242,7 @@
 block discarded – undo
242 242
         }
243 243
         
244 244
         $this->logger->warning("all authentication adapter have failed", [
245
-           'category' => get_class($this)
245
+            'category' => get_class($this)
246 246
         ]);
247 247
 
248 248
         return false;
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Micro
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      * @param   Logger $logger
66 66
      * @return  void
67 67
      */
68
-    public function __construct(?Iterable $config=null, Logger $logger)
68
+    public function __construct(? Iterable $config = null, Logger $logger)
69 69
     {
70 70
         $this->logger = $logger;
71 71
         $this->setOptions($config);
@@ -78,27 +78,27 @@  discard block
 block discarded – undo
78 78
      * @param  Iterable $config
79 79
      * @return Log
80 80
      */
81
-    public function setOptions(?Iterable $config=null): Auth
81
+    public function setOptions(? Iterable $config = null) : Auth
82 82
     {
83
-        if($config === null) {
83
+        if ($config === null) {
84 84
             return $this;
85 85
         }
86 86
 
87
-        foreach($config as $option => $value) {
88
-            switch($option) {
87
+        foreach ($config as $option => $value) {
88
+            switch ($option) {
89 89
                 case 'identity_class': 
90 90
                 case 'attribute_map_class': 
91 91
                     $this->{$option} = (string)$value;
92 92
                 break;
93 93
 
94 94
                 case 'adapter':
95
-                    foreach($value as $name => $adapter) {
96
-                        if(!isset($adapter['enabled']) || $adapter['enabled'] === '1') {
97
-                            if(!isset($adapter['class'])) {
95
+                    foreach ($value as $name => $adapter) {
96
+                        if (!isset($adapter['enabled']) || $adapter['enabled'] === '1') {
97
+                            if (!isset($adapter['class'])) {
98 98
                                 throw new Exception('class option is required');
99 99
                             }
100 100
                         
101
-                            if(isset($adapter['config'])) {
101
+                            if (isset($adapter['config'])) {
102 102
                                 $config = $adapter['config'];
103 103
                             } else {
104 104
                                 $config = null;
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
      * @param  Iterable $config
139 139
      * @return AdapterInterface
140 140
      */
141
-    public function addAdapter(string $name, string $class, ?Iterable $config=null): AdapterInterface
141
+    public function addAdapter(string $name, string $class, ? Iterable $config = null) : AdapterInterface
142 142
     {
143
-        if($this->hasAdapter($name)) {
143
+        if ($this->hasAdapter($name)) {
144 144
             throw new Exception('auth adapter '.$name.' is already registered');
145 145
         }
146 146
             
147 147
         $adapter = new $class($config, $this->logger);
148
-        if(!($adapter instanceof AdapterInterface)) {
148
+        if (!($adapter instanceof AdapterInterface)) {
149 149
             throw new Exception('auth adapter must include AdapterInterface interface');
150 150
         }
151 151
         $this->adapter[$name] = $adapter;
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      */
162 162
     public function getAdapter(string $name): AdapterInterface
163 163
     {
164
-        if(!$this->hasAdapter($name)) {
164
+        if (!$this->hasAdapter($name)) {
165 165
             throw new Exception('auth adapter '.$name.' is not registered');
166 166
         }
167 167
 
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
      * @param  array $adapters
176 176
      * @return array
177 177
      */
178
-    public function getAdapters(array $adapters=[]): array
178
+    public function getAdapters(array $adapters = []): array
179 179
     {
180
-        if(empty($adapter)) {
180
+        if (empty($adapter)) {
181 181
             return $this->adapter;
182 182
         } else {
183 183
             $list = [];
184
-            foreach($adapter as $name) {
185
-                if(!$this->hasAdapter($name)) {
184
+            foreach ($adapter as $name) {
185
+                if (!$this->hasAdapter($name)) {
186 186
                     throw new Exception('auth adapter '.$name.' is not registered');
187 187
                 }
188 188
                 $list[$name] = $this->adapter[$name];
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
     {
218 218
         $result = false;
219 219
         
220
-        foreach($this->adapter as $name => $adapter) {
220
+        foreach ($this->adapter as $name => $adapter) {
221 221
             try {
222 222
                 if ($adapter->authenticate()) {
223 223
                     $this->createIdentity($adapter);      
Please login to merge, or discard this patch.
src/Auth/Adapter/LdapPreauth.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
      * Set options
37 37
      *
38 38
      * @param   Iterable $config
39
-     * @return  LdapServer
39
+     * @return  LdapPreauth
40 40
      */
41 41
     public function setOptions(?Iterable $config=null): LdapServer
42 42
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Micro
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      * @param   Iterable $config
39 39
      * @return  LdapServer
40 40
      */
41
-    public function setOptions(?Iterable $config=null): LdapServer
41
+    public function setOptions(? Iterable $config = null) : LdapServer
42 42
     {
43 43
         if ($config === null) {
44 44
             return $this;
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      */
107 107
     protected function preauth(string $value): bool
108 108
     {
109
-        $parts   = explode('|', $value);
109
+        $parts = explode('|', $value);
110 110
 
111 111
         if (count($parts) !== 2) {
112 112
             $this->logger->warning('invalid header x-preauth value, parts != 2', [
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
             'category' => get_class($this)
194 194
         ]);
195 195
 
196
-        $this->ldap_dn   = $dn;
196
+        $this->ldap_dn = $dn;
197 197
 
198 198
         return true;
199 199
     }
@@ -218,6 +218,6 @@  discard block
 block discarded – undo
218 218
         $ip_decimal = ip2long($ip);
219 219
         $wildcard_decimal = pow(2, (32 - $netmask)) - 1;
220 220
         $netmask_decimal = ~ $wildcard_decimal;
221
-        return (($ip_decimal & $netmask_decimal) == ($range_decimal & $netmask_decimal));
221
+        return (($ip_decimal&$netmask_decimal) == ($range_decimal&$netmask_decimal));
222 222
     }
223 223
 }
Please login to merge, or discard this patch.
src/Auth/Exception.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Micro
Please login to merge, or discard this patch.
src/Auth/Adapter/AbstractAdapter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Micro
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * @param   Logger $logger
48 48
      * @return  void
49 49
      */
50
-    public function __construct(?Iterable $config, Logger $logger)
50
+    public function __construct(? Iterable $config, Logger $logger)
51 51
     {
52 52
         $this->logger = $logger;
53 53
         $this->setOptions($config);
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      * @param   Iterable $config
72 72
      * @return  AdapterInterface
73 73
      */
74
-    public function setOptions(?Iterable $config=null): AdapterInterface
74
+    public function setOptions(? Iterable $config = null) : AdapterInterface
75 75
     {
76 76
         if ($config === null) {
77 77
             return $this;
Please login to merge, or discard this patch.
src/Auth/Adapter/None.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Micro
Please login to merge, or discard this patch.
src/Auth/Adapter/Oidc.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Micro
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
      * @param   Iterable $config
36 36
      * @return  AdapterInterface
37 37
      */
38
-    public function setOptions(?Iterable $config=null): AdapterInterface
38
+    public function setOptions(? Iterable $config = null) : AdapterInterface
39 39
     {
40 40
         if ($config === null) {
41 41
             return $this;
42 42
         }
43 43
 
44
-        if(isset($config['provider_url'])) {
44
+        if (isset($config['provider_url'])) {
45 45
             $this->discovery_url = (string)$config['provider_url'];
46 46
         }
47 47
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      */    
102 102
     protected function getDiscoveryDocument(): array
103 103
     {
104
-        if($apc = extension_loaded('apc') && apc_exists($this->provider_url)) {
104
+        if ($apc = extension_loaded('apc') && apc_exists($this->provider_url)) {
105 105
             return apc_get($this->provider_url);
106 106
         } else {
107 107
             $ch = curl_init();
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
             $discovery = json_decode($result, true);
113 113
             
114
-            if($apc === true) {
114
+            if ($apc === true) {
115 115
                 apc_store($this->provider_url, $discovery);
116 116
             }
117 117
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     protected function verifyToken(string $token): bool
130 130
     {
131 131
         $discovery = $this->getDiscoverDocument();
132
-        if(!(isset($discovery['authorization_endpoint']))) {
132
+        if (!(isset($discovery['authorization_endpoint']))) {
133 133
             throw new Exception('authorization_endpoint could not be determained');
134 134
         }
135 135
 
Please login to merge, or discard this patch.
src/Auth/Adapter/AdapterInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Micro
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      * @param   Logger $logger
22 22
      * @return  void
23 23
      */
24
-    public function __construct(?Iterable $config, Logger $logger);
24
+    public function __construct(? Iterable $config, Logger $logger);
25 25
 
26 26
 
27 27
     /**
Please login to merge, or discard this patch.
src/Auth/Adapter/Basic/Ldap.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Micro
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      * @param   Logger $logger
51 51
      * @return  void
52 52
      */
53
-    public function __construct(?Iterable $config, Logger $logger)
53
+    public function __construct(? Iterable $config, Logger $logger)
54 54
     {
55 55
         $this->logger = $logger;
56 56
         $this->setOptions($config);
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      * @param   Iterable $config
64 64
      * @return  AdapterInterface
65 65
      */
66
-    public function setOptions(?Iterable $config=null): AdapterInterface
66
+    public function setOptions(? Iterable $config = null) : AdapterInterface
67 67
     {
68 68
         if ($config === null) {
69 69
             return $this;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             }
82 82
         }
83 83
         
84
-        if(!isset($config['ldap'])) {
84
+        if (!isset($config['ldap'])) {
85 85
             $this->ldap = new LdapServer();
86 86
         }
87 87
 
Please login to merge, or discard this patch.
src/Auth/Adapter/Basic/AbstractBasic.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Micro
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             return false;
90 90
         }
91 91
 
92
-        $this->identifier  = $username;
92
+        $this->identifier = $username;
93 93
         return true;
94 94
     }
95 95
 
@@ -100,5 +100,5 @@  discard block
 block discarded – undo
100 100
      * @param  string $username
101 101
      * @return array
102 102
      */
103
-    protected abstract function findIdentity(string $username): ?array;
103
+    protected abstract function findIdentity(string $username): ? array;
104 104
 }
Please login to merge, or discard this patch.