@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $errors = $this->registerReaders($this->getDefaultReaders()); |
81 | 81 | $this->registerCompositeReaders($this->getDefaultCompositeReaders(), $this->readers); |
82 | 82 | |
83 | - if (\count($this->readers) === 0) { |
|
83 | + if (\count($this->readers) === 0){ |
|
84 | 84 | throw $this->bootError($errors); |
85 | 85 | } |
86 | 86 | } |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function get(string $name = self::DEFAULT_READER): ReaderInterface |
92 | 92 | { |
93 | - if ($name === self::DEFAULT_READER) { |
|
93 | + if ($name === self::DEFAULT_READER){ |
|
94 | 94 | $name = $this->default; |
95 | 95 | } |
96 | 96 | |
97 | 97 | $reader = $this->readers[$name] ?? null; |
98 | 98 | |
99 | - if ($reader === null) { |
|
99 | + if ($reader === null){ |
|
100 | 100 | throw new NotFoundException(\sprintf(self::ERROR_DRIVER_NOT_FOUND, $name)); |
101 | 101 | } |
102 | 102 | |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | { |
128 | 128 | $messages = []; |
129 | 129 | |
130 | - foreach ($errors as $reader => $message) { |
|
130 | + foreach ($errors as $reader => $message){ |
|
131 | 131 | $messages[] = \sprintf(' - %s: %s', $reader, $message); |
132 | 132 | } |
133 | 133 | |
134 | - $message = self::ERROR_DRIVER_NOT_AVAILABLE . ":\n" . \implode($messages); |
|
134 | + $message = self::ERROR_DRIVER_NOT_AVAILABLE.":\n".\implode($messages); |
|
135 | 135 | return new InitializationException($message); |
136 | 136 | } |
137 | 137 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | private function registerCustomReaders(iterable $readers): void |
143 | 143 | { |
144 | - foreach ($readers as $name => $reader) { |
|
144 | + foreach ($readers as $name => $reader){ |
|
145 | 145 | $name = \is_string($name) ? $name : \get_class($reader); |
146 | 146 | |
147 | 147 | assert(is_subclass_of($name, ReaderInterface::class), 'Precondition failed'); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | private function registerCompositeReaders(iterable $readers, array $registered): void |
159 | 159 | { |
160 | - if (\count($registered) !== 0) { |
|
160 | + if (\count($registered) !== 0){ |
|
161 | 161 | $this->registerReaders($readers, [$registered]); |
162 | 162 | } |
163 | 163 | } |
@@ -171,14 +171,14 @@ discard block |
||
171 | 171 | { |
172 | 172 | $errors = []; |
173 | 173 | |
174 | - foreach ($readers as $reader) { |
|
175 | - try { |
|
176 | - if (isset($this->readers[$reader])) { |
|
174 | + foreach ($readers as $reader){ |
|
175 | + try{ |
|
176 | + if (isset($this->readers[$reader])){ |
|
177 | 177 | continue; |
178 | 178 | } |
179 | 179 | |
180 | 180 | $this->readers[$reader] = new $reader(...\array_values($arguments)); |
181 | - } catch (InitializationException $e) { |
|
181 | + }catch (InitializationException $e){ |
|
182 | 182 | $errors[$reader] = $e->getMessage(); |
183 | 183 | } |
184 | 184 | } |
@@ -80,7 +80,8 @@ discard block |
||
80 | 80 | $errors = $this->registerReaders($this->getDefaultReaders()); |
81 | 81 | $this->registerCompositeReaders($this->getDefaultCompositeReaders(), $this->readers); |
82 | 82 | |
83 | - if (\count($this->readers) === 0) { |
|
83 | + if (\count($this->readers) === 0) |
|
84 | + { |
|
84 | 85 | throw $this->bootError($errors); |
85 | 86 | } |
86 | 87 | } |
@@ -90,13 +91,15 @@ discard block |
||
90 | 91 | */ |
91 | 92 | public function get(string $name = self::DEFAULT_READER): ReaderInterface |
92 | 93 | { |
93 | - if ($name === self::DEFAULT_READER) { |
|
94 | + if ($name === self::DEFAULT_READER) |
|
95 | + { |
|
94 | 96 | $name = $this->default; |
95 | 97 | } |
96 | 98 | |
97 | 99 | $reader = $this->readers[$name] ?? null; |
98 | 100 | |
99 | - if ($reader === null) { |
|
101 | + if ($reader === null) |
|
102 | + { |
|
100 | 103 | throw new NotFoundException(\sprintf(self::ERROR_DRIVER_NOT_FOUND, $name)); |
101 | 104 | } |
102 | 105 | |
@@ -127,7 +130,8 @@ discard block |
||
127 | 130 | { |
128 | 131 | $messages = []; |
129 | 132 | |
130 | - foreach ($errors as $reader => $message) { |
|
133 | + foreach ($errors as $reader => $message) |
|
134 | + { |
|
131 | 135 | $messages[] = \sprintf(' - %s: %s', $reader, $message); |
132 | 136 | } |
133 | 137 | |
@@ -141,7 +145,8 @@ discard block |
||
141 | 145 | */ |
142 | 146 | private function registerCustomReaders(iterable $readers): void |
143 | 147 | { |
144 | - foreach ($readers as $name => $reader) { |
|
148 | + foreach ($readers as $name => $reader) |
|
149 | + { |
|
145 | 150 | $name = \is_string($name) ? $name : \get_class($reader); |
146 | 151 | |
147 | 152 | assert(is_subclass_of($name, ReaderInterface::class), 'Precondition failed'); |
@@ -157,7 +162,8 @@ discard block |
||
157 | 162 | */ |
158 | 163 | private function registerCompositeReaders(iterable $readers, array $registered): void |
159 | 164 | { |
160 | - if (\count($registered) !== 0) { |
|
165 | + if (\count($registered) !== 0) |
|
166 | + { |
|
161 | 167 | $this->registerReaders($readers, [$registered]); |
162 | 168 | } |
163 | 169 | } |
@@ -171,14 +177,19 @@ discard block |
||
171 | 177 | { |
172 | 178 | $errors = []; |
173 | 179 | |
174 | - foreach ($readers as $reader) { |
|
175 | - try { |
|
176 | - if (isset($this->readers[$reader])) { |
|
180 | + foreach ($readers as $reader) |
|
181 | + { |
|
182 | + try |
|
183 | + { |
|
184 | + if (isset($this->readers[$reader])) |
|
185 | + { |
|
177 | 186 | continue; |
178 | 187 | } |
179 | 188 | |
180 | 189 | $this->readers[$reader] = new $reader(...\array_values($arguments)); |
181 | - } catch (InitializationException $e) { |
|
190 | + } |
|
191 | + catch (InitializationException $e) |
|
192 | + { |
|
182 | 193 | $errors[$reader] = $e->getMessage(); |
183 | 194 | } |
184 | 195 | } |