Conditions | 13 |
Paths | 10 |
Total Lines | 90 |
Code Lines | 61 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
116 | protected function createSubSeller(int $subSellerId) |
||
117 | { |
||
118 | try { |
||
119 | $subSeller = $this->subSellerRepository->get($subSellerId); |
||
120 | } catch (LocalizedException $exc) { |
||
121 | $this->writeln('<error>'.$exc->getMessage().'</error>'); |
||
122 | |||
123 | return; |
||
124 | } |
||
125 | |||
126 | if ($subSeller->getId()) { |
||
127 | $typePersona = (bool) $subSeller->getType(); |
||
128 | if ($subSeller->getIdExt()) { |
||
129 | $messageErrors = __('O Sub Seller já possuí id de relacionamento na Getnet'); |
||
130 | $this->writeln(sprintf('<error>%s</error>', $messageErrors)); |
||
131 | |||
132 | return; |
||
133 | } |
||
134 | |||
135 | $formatedData = $this->getnetHelper->formatedData($subSeller, $typePersona); |
||
136 | $messageInfo = __('Send Sub Seller internal code: %1', $subSeller->getCode()); |
||
137 | $this->writeln(sprintf('<info>%s</info>', $messageInfo)); |
||
138 | $this->writeln($this->json->serialize($formatedData)); |
||
139 | $response = $this->sendData($formatedData, $typePersona); |
||
140 | |||
141 | if ($response->getErrors()) { |
||
142 | foreach ($response->getErrors() as $error) { |
||
143 | $errors[] = $error; |
||
144 | } |
||
145 | $listErrors = implode(', ', $errors); |
||
146 | |||
147 | $subSeller->setStatus('4'); |
||
148 | $subSeller->setStatusComment($listErrors); |
||
149 | $subSeller->save(); |
||
150 | $messageErrors = __('Unable to register, errors found: %1', $listErrors); |
||
151 | $this->writeln(sprintf('<error>%s</error>', $messageErrors)); |
||
152 | |||
153 | return; |
||
154 | } |
||
155 | |||
156 | if ($response->getMessage()) { |
||
157 | $errors[] = $response->getMessage(); |
||
158 | if (is_array($response->getMessage())) { |
||
159 | unset($errors); |
||
160 | foreach ($response->getMessage() as $key => $error) { |
||
161 | $errors[] = $error; |
||
162 | if (is_array($error)) { |
||
163 | unset($errors); |
||
164 | foreach ($error as $typeError) { |
||
165 | $errors[] = $typeError.' field '.$key; |
||
166 | } |
||
167 | } |
||
168 | } |
||
169 | } |
||
170 | $listErrors = implode(', ', $errors); |
||
171 | $subSeller->setStatus('5'); |
||
172 | $subSeller->setStatusComment($listErrors); |
||
173 | $subSeller->save(); |
||
174 | $messageErrors = __('Unable to register, errors found: %1', $listErrors); |
||
175 | $this->writeln(sprintf('<error>%s</error>', $messageErrors)); |
||
176 | |||
177 | return; |
||
178 | } |
||
179 | |||
180 | if ($response->getSubsellerId()) { |
||
181 | $subSeller->setIdExt($response->getSubsellerId()); |
||
182 | $subSeller->setStatus('2'); |
||
183 | $subSeller->setStatusComment('Waiting for registration approval.'); |
||
184 | |||
185 | if ($response->getEnabled() === 'S') { |
||
186 | $subSeller->setStatus('3'); |
||
187 | $subSeller->setStatusComment('Authorized for sales.'); |
||
188 | } |
||
189 | |||
190 | $subSeller->save(); |
||
191 | $messageResponse = __( |
||
192 | 'Success, the sub seller id: %1, enable to sales: %2, id getnet: %3', |
||
193 | $response->getCode(), |
||
194 | $response->getEnabled(), |
||
195 | $response->getSubsellerId() |
||
196 | ); |
||
197 | $this->writeln(sprintf('<info>%s</info>', $messageResponse)); |
||
198 | |||
199 | return; |
||
200 | } |
||
201 | |||
202 | $messageErrorConection = __('Connection Error: %1', $response->getDetails()); |
||
203 | $this->writeln(sprintf('<error>%s</error>', $messageErrorConection)); |
||
204 | |||
205 | return; |
||
206 | } |
||
270 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths