Conditions | 6 |
Paths | 8 |
Total Lines | 52 |
Code Lines | 33 |
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 |
||
113 | protected function updateDataSubSeller(int $subSellerId) |
||
114 | { |
||
115 | try { |
||
116 | $subSeller = $this->subSellerRepository->get($subSellerId); |
||
117 | } catch (LocalizedException $exc) { |
||
118 | $this->writeln('<error>'.$exc->getMessage().'</error>'); |
||
119 | |||
120 | return; |
||
121 | } |
||
122 | |||
123 | if ($subSeller->getId()) { |
||
124 | if (!$subSeller->getIdExt()) { |
||
125 | $messageErrors = __('The Sub Seller does not have a relationship id on Getnet.'); |
||
126 | $this->writeln(sprintf('<error>%s</error>', $messageErrors)); |
||
127 | } |
||
128 | |||
129 | $typePersona = (bool) $subSeller->getType(); |
||
130 | $legalDocument = preg_replace('/[^0-9]/', '', $subSeller->getLegalDocumentNumber()); |
||
131 | |||
132 | $messageInfo = __('Get Data to Sub Seller internal code: %1', $subSeller->getCode()); |
||
133 | $this->writeln(sprintf('<info>%s</info>', $messageInfo)); |
||
134 | |||
135 | $response = $this->getDataOnGetnet( |
||
136 | $typePersona, |
||
137 | $legalDocument, |
||
138 | $subSeller->getMerchantId() |
||
139 | ); |
||
140 | |||
141 | if ($response->getSubsellerId()) { |
||
142 | if ($response->getEnabled() === 'S') { |
||
143 | $subSeller->setIdExt($response->getSubsellerId()); |
||
144 | $subSeller->setStatus(3); |
||
145 | $subSeller->setStatusComment(null); |
||
146 | $subSeller->save(); |
||
147 | } |
||
148 | |||
149 | $messageResponse = __( |
||
150 | 'Success, sub seller id: %1, enable to sale: %2', |
||
151 | $response->getSubsellerId(), |
||
152 | $response->getEnabled() |
||
153 | ); |
||
154 | $this->writeln(sprintf('<info>%s</info>', $messageResponse)); |
||
155 | |||
156 | return; |
||
157 | } |
||
158 | |||
159 | $messageErrorConection = __('Error: %1', $response->getDetails()); |
||
160 | $this->writeln(sprintf('<error>%s</error>', $messageErrorConection)); |
||
161 | |||
162 | return; |
||
163 | } |
||
164 | $this->writeln('<error>'.__('Error').'</error>'); |
||
165 | } |
||
210 |
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