@@ -1,5 +1,5 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -1,5 +1,5 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Micro |
@@ -83,21 +83,21 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | switch ($value['type']) { |
| 85 | 85 | case 'array': |
| 86 | - $arr = (array)$data[$value['attr']]; |
|
| 86 | + $arr = (array)$data[$value['attr']]; |
|
| 87 | 87 | unset($arr['count']); |
| 88 | 88 | $attrs[$attr] = $arr; |
| 89 | 89 | break; |
| 90 | 90 | |
| 91 | 91 | case 'string': |
| 92 | - $attrs[$attr] = (string)$store; |
|
| 92 | + $attrs[$attr] = (string)$store; |
|
| 93 | 93 | break; |
| 94 | 94 | |
| 95 | 95 | case 'int': |
| 96 | - $attrs[$attr] = (int)$store; |
|
| 96 | + $attrs[$attr] = (int)$store; |
|
| 97 | 97 | break; |
| 98 | 98 | |
| 99 | 99 | case 'bool': |
| 100 | - $attrs[$attr] = (bool)$store; |
|
| 100 | + $attrs[$attr] = (bool)$store; |
|
| 101 | 101 | break; |
| 102 | 102 | |
| 103 | 103 | default: |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Micro |
@@ -1,5 +1,5 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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); |