@@ -13,9 +13,9 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | abstract class AFactory { |
| 15 | 15 | /** @var array<string,AGateway|AProvider|ISMSProvider> */ |
| 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 | abstract protected function getSuffix(): string; |
@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | /** @return AGateway|AProvider|ISMSProvider */ |
| 29 | 29 | public function get(string $name): object { |
| 30 | 30 | $needle = strtolower($name); |
| 31 | - if (isset($this->instances[$needle])) { |
|
| 32 | - return $this->instances[$needle]; |
|
| 31 | + if (isset($this->instances[ $needle ])) { |
|
| 32 | + return $this->instances[ $needle ]; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | foreach ($this->getFqcnList() as $fqcn) { |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | continue; |
| 39 | 39 | } |
| 40 | 40 | $instance = \OCP\Server::get($fqcn); |
| 41 | - $this->instances[$needle] = $instance; |
|
| 41 | + $this->instances[ $needle ] = $instance; |
|
| 42 | 42 | return $instance; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | return $this->fqcn; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - $loader = require __DIR__ . '/../../vendor/autoload.php'; |
|
| 54 | + $loader = require __DIR__.'/../../vendor/autoload.php'; |
|
| 55 | 55 | foreach ($loader->getClassMap() as $fqcn => $_) { |
| 56 | 56 | $type = $this->typeFrom($fqcn); |
| 57 | 57 | if ($type === null) { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | if (!$this->isValid($fqcn)) { |
| 64 | 64 | continue; |
| 65 | 65 | } |
| 66 | - $this->fqcn[] = $fqcn; |
|
| 66 | + $this->fqcn[ ] = $fqcn; |
|
| 67 | 67 | } |
| 68 | 68 | return $this->fqcn; |
| 69 | 69 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | return null; |
| 79 | 79 | } |
| 80 | 80 | $type = substr($fqcn, strlen($prefix)); |
| 81 | - $type = substr($type, 0, -strlen('\\' . $suffix)); |
|
| 81 | + $type = substr($type, 0, -strlen('\\'.$suffix)); |
|
| 82 | 82 | if (strpos($type, '\\') !== false || $type === '') { |
| 83 | 83 | return null; |
| 84 | 84 | } |
@@ -12,17 +12,17 @@ |
||
| 12 | 12 | use OCA\TwoFactorGateway\Provider\AFactory; |
| 13 | 13 | |
| 14 | 14 | class Factory extends AFactory { |
| 15 | - #[\Override] |
|
| 15 | + #[\Override ] |
|
| 16 | 16 | protected function getPrefix(): string { |
| 17 | 17 | return 'OCA\\TwoFactorGateway\\Provider\\Channel\\'; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - #[\Override] |
|
| 20 | + #[\Override ] |
|
| 21 | 21 | protected function getSuffix(): string { |
| 22 | 22 | return 'Gateway'; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - #[\Override] |
|
| 25 | + #[\Override ] |
|
| 26 | 26 | protected function getBaseClass(): string { |
| 27 | 27 | return IGateway::class; |
| 28 | 28 | } |
@@ -15,38 +15,38 @@ |
||
| 15 | 15 | |
| 16 | 16 | class Factory extends AFactory { |
| 17 | 17 | /** @var array<string,IProvider> */ |
| 18 | - protected array $instances = []; |
|
| 19 | - #[\Override] |
|
| 18 | + protected array $instances = [ ]; |
|
| 19 | + #[\Override ] |
|
| 20 | 20 | protected function getPrefix(): string { |
| 21 | 21 | return 'OCA\\TwoFactorGateway\\Provider\\Channel\\SMS\\Provider\\Drivers\\'; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - #[\Override] |
|
| 24 | + #[\Override ] |
|
| 25 | 25 | protected function getSuffix(): string { |
| 26 | 26 | return ''; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - #[\Override] |
|
| 29 | + #[\Override ] |
|
| 30 | 30 | protected function getBaseClass(): string { |
| 31 | 31 | return IProvider::class; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - #[\Override] |
|
| 34 | + #[\Override ] |
|
| 35 | 35 | public function isValid(string $fqcn): bool { |
| 36 | 36 | return defined("$fqcn::SCHEMA") |
| 37 | 37 | && is_array($fqcn::SCHEMA); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - #[\Override] |
|
| 40 | + #[\Override ] |
|
| 41 | 41 | public function get(string $name): IProvider { |
| 42 | - if (isset($this->instances[$name])) { |
|
| 43 | - return $this->instances[$name]; |
|
| 42 | + if (isset($this->instances[ $name ])) { |
|
| 43 | + return $this->instances[ $name ]; |
|
| 44 | 44 | } |
| 45 | 45 | foreach ($this->getFqcnList() as $fqcn) { |
| 46 | 46 | if ($fqcn::getProviderId() === $name) { |
| 47 | 47 | $instance = \OCP\Server::get($fqcn); |
| 48 | 48 | $instance->setAppConfig(\OCP\Server::get(\OCP\IAppConfig::class)); |
| 49 | - $this->instances[$name] = $instance; |
|
| 49 | + $this->instances[ $name ] = $instance; |
|
| 50 | 50 | return $instance; |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -25,16 +25,16 @@ discard block |
||
| 25 | 25 | ) { |
| 26 | 26 | parent::__construct('twofactorauth:gateway:test'); |
| 27 | 27 | |
| 28 | - $ids = []; |
|
| 28 | + $ids = [ ]; |
|
| 29 | 29 | $fqcn = $this->gatewayFactory->getFqcnList(); |
| 30 | 30 | foreach ($fqcn as $fqcn) { |
| 31 | - $ids[] = $fqcn::getProviderId(); |
|
| 31 | + $ids[ ] = $fqcn::getProviderId(); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | $this->addArgument( |
| 35 | 35 | 'gateway', |
| 36 | 36 | InputArgument::REQUIRED, |
| 37 | - 'The name of the gateway: ' . implode(', ', $ids) |
|
| 37 | + 'The name of the gateway: '.implode(', ', $ids) |
|
| 38 | 38 | ); |
| 39 | 39 | $this->addArgument( |
| 40 | 40 | 'identifier', |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | ); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - #[\Override] |
|
| 46 | + #[\Override ] |
|
| 47 | 47 | protected function execute(InputInterface $input, OutputInterface $output) { |
| 48 | 48 | $gatewayName = $input->getArgument('gateway'); |
| 49 | 49 | $identifier = $input->getArgument('identifier'); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | return 1; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $gateway->send($identifier, 'Test', ['code' => '123456']); |
|
| 58 | + $gateway->send($identifier, 'Test', [ 'code' => '123456' ]); |
|
| 59 | 59 | return 0; |
| 60 | 60 | } |
| 61 | 61 | } |