@@ -11,17 +11,17 @@ |
||
| 11 | 11 | |
| 12 | 12 | /** @extends AFactory<AProvider> */ |
| 13 | 13 | class Factory extends AFactory { |
| 14 | - #[\Override] |
|
| 14 | + #[\Override ] |
|
| 15 | 15 | protected function getPrefix(): string { |
| 16 | 16 | return 'OCA\\TwoFactorGateway\\Provider\\Channel\\'; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - #[\Override] |
|
| 19 | + #[\Override ] |
|
| 20 | 20 | protected function getSuffix(): string { |
| 21 | 21 | return 'Provider'; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - #[\Override] |
|
| 24 | + #[\Override ] |
|
| 25 | 25 | protected function getBaseClass(): string { |
| 26 | 26 | return AProvider::class; |
| 27 | 27 | } |
@@ -15,31 +15,31 @@ |
||
| 15 | 15 | |
| 16 | 16 | /** @extends AFactory<AProvider> */ |
| 17 | 17 | class Factory extends AFactory { |
| 18 | - #[\Override] |
|
| 18 | + #[\Override ] |
|
| 19 | 19 | protected function getPrefix(): string { |
| 20 | 20 | return 'OCA\\TwoFactorGateway\\Provider\\Channel\\SMS\\Provider\\Drivers\\'; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - #[\Override] |
|
| 23 | + #[\Override ] |
|
| 24 | 24 | protected function getSuffix(): string { |
| 25 | 25 | return ''; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - #[\Override] |
|
| 28 | + #[\Override ] |
|
| 29 | 29 | protected function getBaseClass(): string { |
| 30 | 30 | return AProvider::class; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - #[\Override] |
|
| 33 | + #[\Override ] |
|
| 34 | 34 | public function get(string $name): object { |
| 35 | - if (isset($this->instances[$name])) { |
|
| 36 | - return $this->instances[$name]; |
|
| 35 | + if (isset($this->instances[ $name ])) { |
|
| 36 | + return $this->instances[ $name ]; |
|
| 37 | 37 | } |
| 38 | 38 | foreach ($this->getFqcnList() as $fqcn) { |
| 39 | 39 | $instance = \OCP\Server::get($fqcn); |
| 40 | 40 | if ($instance->getSettings()->id === $name) { |
| 41 | 41 | $instance->setAppConfig(\OCP\Server::get(\OCP\IAppConfig::class)); |
| 42 | - $this->instances[$name] = $instance; |
|
| 42 | + $this->instances[ $name ] = $instance; |
|
| 43 | 43 | return $instance; |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -13,17 +13,17 @@ |
||
| 13 | 13 | |
| 14 | 14 | /** @extends AFactory<AGateway> */ |
| 15 | 15 | class Factory extends AFactory { |
| 16 | - #[\Override] |
|
| 16 | + #[\Override ] |
|
| 17 | 17 | protected function getPrefix(): string { |
| 18 | 18 | return 'OCA\\TwoFactorGateway\\Provider\\Channel\\'; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - #[\Override] |
|
| 21 | + #[\Override ] |
|
| 22 | 22 | protected function getSuffix(): string { |
| 23 | 23 | return 'Gateway'; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - #[\Override] |
|
| 26 | + #[\Override ] |
|
| 27 | 27 | protected function getBaseClass(): string { |
| 28 | 28 | return AGateway::class; |
| 29 | 29 | } |
@@ -9,9 +9,9 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | /** @todo see the README.md in this directory */ |
| 12 | -require __DIR__ . '/../../../../../../../vendor-bin/telegram-client/vendor/autoload.php'; |
|
| 13 | -require __DIR__ . '/Login.php'; |
|
| 14 | -require __DIR__ . '/SendMessage.php'; |
|
| 12 | +require __DIR__.'/../../../../../../../vendor-bin/telegram-client/vendor/autoload.php'; |
|
| 13 | +require __DIR__.'/Login.php'; |
|
| 14 | +require __DIR__.'/SendMessage.php'; |
|
| 15 | 15 | |
| 16 | 16 | use OCA\TwoFactorGateway\Provider\Channel\Telegram\Provider\Drivers\ClientCli\Login; |
| 17 | 17 | use OCA\TwoFactorGateway\Provider\Channel\Telegram\Provider\Drivers\ClientCli\SendMessage; |
@@ -15,31 +15,31 @@ |
||
| 15 | 15 | |
| 16 | 16 | /** @extends AFactory<AProvider> */ |
| 17 | 17 | class Factory extends AFactory { |
| 18 | - #[\Override] |
|
| 18 | + #[\Override ] |
|
| 19 | 19 | protected function getPrefix(): string { |
| 20 | 20 | return 'OCA\\TwoFactorGateway\\Provider\\Channel\\Telegram\\Provider\\Drivers\\'; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - #[\Override] |
|
| 23 | + #[\Override ] |
|
| 24 | 24 | protected function getSuffix(): string { |
| 25 | 25 | return ''; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - #[\Override] |
|
| 28 | + #[\Override ] |
|
| 29 | 29 | protected function getBaseClass(): string { |
| 30 | 30 | return AProvider::class; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - #[\Override] |
|
| 33 | + #[\Override ] |
|
| 34 | 34 | public function get(string $name): object { |
| 35 | - if (isset($this->instances[$name])) { |
|
| 36 | - return $this->instances[$name]; |
|
| 35 | + if (isset($this->instances[ $name ])) { |
|
| 36 | + return $this->instances[ $name ]; |
|
| 37 | 37 | } |
| 38 | 38 | foreach ($this->getFqcnList() as $fqcn) { |
| 39 | 39 | $instance = \OCP\Server::get($fqcn); |
| 40 | 40 | if ($instance->getSettings()->id === $name) { |
| 41 | 41 | $instance->setAppConfig(\OCP\Server::get(\OCP\IAppConfig::class)); |
| 42 | - $this->instances[$name] = $instance; |
|
| 42 | + $this->instances[ $name ] = $instance; |
|
| 43 | 43 | return $instance; |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -13,9 +13,9 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | abstract class AFactory { |
| 15 | 15 | /** @var array<string, T> */ |
| 16 | - protected array $instances = []; |
|
| 16 | + protected array $instances = [ ]; |
|
| 17 | 17 | /** @var array<string> */ |
| 18 | - protected array $fqcn = []; |
|
| 18 | + protected array $fqcn = [ ]; |
|
| 19 | 19 | |
| 20 | 20 | abstract protected function getPrefix(): string; |
| 21 | 21 | |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | true => $this->typeFrom($name), |
| 34 | 34 | false => strtolower($name), |
| 35 | 35 | }; |
| 36 | - if (isset($this->instances[$needle])) { |
|
| 37 | - return $this->instances[$needle]; |
|
| 36 | + if (isset($this->instances[ $needle ])) { |
|
| 37 | + return $this->instances[ $needle ]; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | foreach ($this->getFqcnList() as $fqcn) { |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | continue; |
| 44 | 44 | } |
| 45 | 45 | $instance = \OCP\Server::get($fqcn); |
| 46 | - $this->instances[$type] = $instance; |
|
| 46 | + $this->instances[ $type ] = $instance; |
|
| 47 | 47 | return $instance; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | return $this->fqcn; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - $loader = require __DIR__ . '/../../vendor/autoload.php'; |
|
| 59 | + $loader = require __DIR__.'/../../vendor/autoload.php'; |
|
| 60 | 60 | foreach ($loader->getClassMap() as $fqcn => $_) { |
| 61 | 61 | $type = $this->typeFrom($fqcn); |
| 62 | 62 | if ($type === null) { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | if (!is_subclass_of($fqcn, $this->getBaseClass(), true)) { |
| 66 | 66 | continue; |
| 67 | 67 | } |
| 68 | - $this->fqcn[] = $fqcn; |
|
| 68 | + $this->fqcn[ ] = $fqcn; |
|
| 69 | 69 | } |
| 70 | 70 | return $this->fqcn; |
| 71 | 71 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | return null; |
| 81 | 81 | } |
| 82 | 82 | $type = substr($fqcn, strlen($prefix)); |
| 83 | - $type = substr($type, 0, -strlen('\\' . $suffix)); |
|
| 83 | + $type = substr($type, 0, -strlen('\\'.$suffix)); |
|
| 84 | 84 | if (strpos($type, '\\') !== false || $type === '') { |
| 85 | 85 | return null; |
| 86 | 86 | } |