Conditions | 12 |
Paths | 16 |
Total Lines | 74 |
Code Lines | 47 |
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 |
||
115 | protected function updateSubSeller(int $subSellerId) |
||
116 | { |
||
117 | try { |
||
118 | $subSeller = $this->subSellerRepository->get($subSellerId); |
||
119 | } catch (LocalizedException $exc) { |
||
120 | $this->writeln('<error>'.$exc->getMessage().'</error>'); |
||
121 | |||
122 | return; |
||
123 | } |
||
124 | |||
125 | if ($subSeller->getId()) { |
||
126 | $typePersona = (bool) $subSeller->getType(); |
||
127 | if (!$subSeller->getIdExt()) { |
||
128 | $messageErrors = __('The Sub Seller does not have a relationship id on Getnet'); |
||
129 | $this->writeln(sprintf('<error>%s</error>', $messageErrors)); |
||
130 | } |
||
131 | |||
132 | $messageInfo = __('Send Sub Seller internal code: %1', $subSeller->getCode()); |
||
133 | $this->writeln(sprintf('<info>%s</info>', $messageInfo)); |
||
134 | $formatedData = $this->getnetHelper->formatedData($subSeller, $typePersona, 'seller_update'); |
||
135 | $this->writeln($this->json->serialize($formatedData)); |
||
136 | $response = $this->updateData($formatedData, $typePersona, (int) $subSeller->getStatus()); |
||
137 | |||
138 | if ($response->getErrors()) { |
||
139 | foreach ($response->getErrors() as $error) { |
||
140 | $errors[] = $error; |
||
141 | } |
||
142 | $listErrors = implode(', ', $errors); |
||
143 | $messageErrors = __('Could not update registration, errors found: %1', $listErrors); |
||
144 | $this->writeln(sprintf('<error>%s</error>', $messageErrors)); |
||
145 | |||
146 | return; |
||
147 | } |
||
148 | |||
149 | if ($response->getMessage()) { |
||
150 | $errors[] = $response->getMessage(); |
||
151 | if (is_array($response->getMessage())) { |
||
152 | unset($errors); |
||
153 | foreach ($response->getMessage() as $key => $error) { |
||
154 | foreach ($error as $typeError) { |
||
155 | $errors[] = $typeError.' field '.$key; |
||
156 | } |
||
157 | } |
||
158 | } |
||
159 | $listErrors = implode(', ', $errors); |
||
160 | $messageErrors = __('Could not update registration, errors found: %1', $listErrors); |
||
161 | $this->writeln(sprintf('<error>%s</error>', $messageErrors)); |
||
162 | |||
163 | return; |
||
164 | } |
||
165 | |||
166 | if ($response->getSuccess()) { |
||
167 | $this->writeln('<info>Done!</info>'); |
||
168 | |||
169 | return; |
||
170 | } |
||
171 | |||
172 | if ($response->getSubsellerId()) { |
||
173 | $messageResponse = __( |
||
174 | 'Success, the sub seller id: %1, enable to sales: %2, id getnet: %3', |
||
175 | $response->getSubsellerId(), |
||
176 | $response->getEnabled() |
||
177 | ); |
||
178 | $this->writeln(sprintf('<info>%s</info>', $messageResponse)); |
||
179 | |||
180 | return; |
||
181 | } |
||
182 | |||
183 | $messageErrorConection = __('Connection Error: %1', json_encode($response)); |
||
184 | $this->writeln(sprintf('<error>%s</error>', $messageErrorConection)); |
||
185 | |||
186 | return; |
||
187 | } |
||
188 | $this->writeln('<error>'.__('Error').'</error>'); |
||
189 | } |
||
269 |
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