@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | abstract class AGateway implements IGateway { |
19 | 19 | use TConfigurable; |
20 | - public const SCHEMA = []; |
|
20 | + public const SCHEMA = [ ]; |
|
21 | 21 | |
22 | 22 | public function __construct( |
23 | 23 | public IAppConfig $appConfig, |
@@ -27,58 +27,58 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * @throws MessageTransmissionException |
29 | 29 | */ |
30 | - #[\Override] |
|
31 | - abstract public function send(string $identifier, string $message, array $extra = []): void; |
|
30 | + #[\Override ] |
|
31 | + abstract public function send(string $identifier, string $message, array $extra = [ ]): void; |
|
32 | 32 | |
33 | - #[\Override] |
|
34 | - public function isComplete(array $schema = []): bool { |
|
33 | + #[\Override ] |
|
34 | + public function isComplete(array $schema = [ ]): bool { |
|
35 | 35 | if (empty($schema)) { |
36 | 36 | $schema = static::SCHEMA; |
37 | 37 | } |
38 | 38 | $set = $this->appConfig->getKeys(Application::APP_ID); |
39 | - $fields = array_column($schema['fields'], 'field'); |
|
40 | - $fields = array_map(fn ($f) => $this->getProviderId() . '_' . $f, $fields); |
|
39 | + $fields = array_column($schema[ 'fields' ], 'field'); |
|
40 | + $fields = array_map(fn ($f) => $this->getProviderId().'_'.$f, $fields); |
|
41 | 41 | $intersect = array_intersect($fields, $set); |
42 | 42 | return count($intersect) === count($fields); |
43 | 43 | } |
44 | 44 | |
45 | - #[\Override] |
|
46 | - public function getConfiguration(array $schema = []): array { |
|
45 | + #[\Override ] |
|
46 | + public function getConfiguration(array $schema = [ ]): array { |
|
47 | 47 | if (empty($schema)) { |
48 | 48 | $schema = static::SCHEMA; |
49 | 49 | } |
50 | 50 | $providerId = $this->getProviderId(); |
51 | - $config = []; |
|
52 | - foreach ($schema['fields'] as $f) { |
|
53 | - $config[$f['field']] = $this->appConfig->getValueString( |
|
51 | + $config = [ ]; |
|
52 | + foreach ($schema[ 'fields' ] as $f) { |
|
53 | + $config[ $f[ 'field' ] ] = $this->appConfig->getValueString( |
|
54 | 54 | Application::APP_ID, |
55 | - $providerId . '_' . $f['field'], |
|
56 | - $f['default'] ?? '', |
|
55 | + $providerId.'_'.$f[ 'field' ], |
|
56 | + $f[ 'default' ] ?? '', |
|
57 | 57 | ); |
58 | 58 | } |
59 | 59 | return $config; |
60 | 60 | } |
61 | 61 | |
62 | - #[\Override] |
|
62 | + #[\Override ] |
|
63 | 63 | public function getSettings(): array { |
64 | - $settings = []; |
|
65 | - if (isset(static::SCHEMA['instructions'])) { |
|
66 | - $settings['instructions'] = static::SCHEMA['instructions']; |
|
64 | + $settings = [ ]; |
|
65 | + if (isset(static::SCHEMA[ 'instructions' ])) { |
|
66 | + $settings[ 'instructions' ] = static::SCHEMA[ 'instructions' ]; |
|
67 | 67 | } |
68 | - $settings['name'] = static::SCHEMA['name']; |
|
68 | + $settings[ 'name' ] = static::SCHEMA[ 'name' ]; |
|
69 | 69 | return $settings; |
70 | 70 | } |
71 | 71 | |
72 | - #[\Override] |
|
72 | + #[\Override ] |
|
73 | 73 | abstract public function cliConfigure(InputInterface $input, OutputInterface $output): int; |
74 | 74 | |
75 | - #[\Override] |
|
76 | - public function remove(array $schema = []): void { |
|
75 | + #[\Override ] |
|
76 | + public function remove(array $schema = [ ]): void { |
|
77 | 77 | if (empty($schema)) { |
78 | 78 | $schema = static::SCHEMA; |
79 | 79 | } |
80 | - foreach ($schema['fields'] as $field) { |
|
81 | - $method = 'delete' . $this->toCamel($field['field']); |
|
80 | + foreach ($schema[ 'fields' ] as $field) { |
|
81 | + $method = 'delete'.$this->toCamel($field[ 'field' ]); |
|
82 | 82 | $this->{$method}(); |
83 | 83 | } |
84 | 84 | } |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | return str_replace(' ', '', ucwords(str_replace('_', ' ', $field))); |
88 | 88 | } |
89 | 89 | |
90 | - #[\Override] |
|
90 | + #[\Override ] |
|
91 | 91 | public static function getProviderId(): string { |
92 | 92 | $id = self::deriveIdFromFqcn(static::class); |
93 | 93 | if ($id === null) { |
94 | - throw new \LogicException('Cannot derive gateway id from FQCN: ' . static::class); |
|
94 | + throw new \LogicException('Cannot derive gateway id from FQCN: '.static::class); |
|
95 | 95 | } |
96 | 96 | return $id; |
97 | 97 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | parent::__construct('twofactorauth:gateway:status'); |
24 | 24 | } |
25 | 25 | |
26 | - #[\Override] |
|
26 | + #[\Override ] |
|
27 | 27 | protected function execute(InputInterface $input, OutputInterface $output) { |
28 | 28 | $fqcn = $this->gatewayFactory->getFqcnList(); |
29 | 29 | foreach ($fqcn as $fqcn) { |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $gateway = $this->gatewayFactory->get($fqcn::getProviderId()); |
32 | 32 | $isConfigured = $gateway->isComplete(); |
33 | 33 | $settings = $gateway->getSettings(); |
34 | - $output->writeln($settings['name'] . ': ' . ($isConfigured ? 'configured' : 'not configured')); |
|
34 | + $output->writeln($settings[ 'name' ].': '.($isConfigured ? 'configured' : 'not configured')); |
|
35 | 35 | $output->write(print_r($gateway->getConfiguration(), true), true, OutputInterface::VERBOSITY_VERBOSE); |
36 | 36 | } |
37 | 37 | return 0; |