Conditions | 10 |
Paths | 257 |
Total Lines | 35 |
Code Lines | 22 |
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 |
||
27 | public function execute(\Magento\Framework\Event\Observer $observer) |
||
28 | { |
||
29 | $input = $observer->getEvent()->getInput(); |
||
30 | /** @var \Magento\Sales\Model\Order\Creditmemo $creditmemo */ |
||
31 | $creditmemo = $observer->getEvent()->getCreditmemo(); |
||
32 | $order = $creditmemo->getOrder(); |
||
33 | |||
34 | if ($order->getPayment()->getMethodInstance()->getCode() === ConfigProviderBoleto::CODE) { |
||
35 | $bankNumber = !empty($input[CreditmemoBlock::BANK_NUMBER]) ? $input[CreditmemoBlock::BANK_NUMBER] : null; |
||
36 | $creditmemo->setData(CreditmemoBlock::BANK_NUMBER, $bankNumber); |
||
37 | |||
38 | $agencyNumber = !empty($input[CreditmemoBlock::AGENCY_NUMBER]) ? $input[CreditmemoBlock::AGENCY_NUMBER] : null; |
||
39 | $creditmemo->setData(CreditmemoBlock::AGENCY_NUMBER, $agencyNumber); |
||
40 | |||
41 | $agencyCheckNumber = !empty($input[CreditmemoBlock::AGENCY_CHECK_NUMBER]) ? $input[CreditmemoBlock::AGENCY_CHECK_NUMBER] : null; |
||
42 | $creditmemo->setData(CreditmemoBlock::AGENCY_CHECK_NUMBER, $agencyCheckNumber); |
||
43 | |||
44 | $accountNumber = !empty($input[CreditmemoBlock::ACCOUNT_NUMBER]) ? $input[CreditmemoBlock::ACCOUNT_NUMBER] : null; |
||
45 | $creditmemo->setData(CreditmemoBlock::ACCOUNT_NUMBER, $accountNumber); |
||
46 | |||
47 | $accountCheckNumber = !empty($input[CreditmemoBlock::ACCOUNT_CHECK_NUMBER]) ? $input[CreditmemoBlock::ACCOUNT_CHECK_NUMBER] : null; |
||
48 | $creditmemo->setData(CreditmemoBlock::ACCOUNT_CHECK_NUMBER, $accountCheckNumber); |
||
49 | |||
50 | $holderFullname = !empty($input[CreditmemoBlock::HOLDER_FULLNAME]) ? $input[CreditmemoBlock::HOLDER_FULLNAME] : null; |
||
51 | $creditmemo->setData(CreditmemoBlock::HOLDER_FULLNAME, $holderFullname); |
||
52 | |||
53 | $holderDocumment = !empty($input[CreditmemoBlock::HOLDER_DOCUMENT_NUMBER]) ? $input[CreditmemoBlock::HOLDER_DOCUMENT_NUMBER] : null; |
||
54 | $creditmemo->setData(CreditmemoBlock::HOLDER_DOCUMENT_NUMBER, $holderDocumment); |
||
55 | |||
56 | $comment = !empty($input[CreditmemoBlock::CREDITMEMO_COMMENT_TEXT]) ? $input[CreditmemoBlock::CREDITMEMO_COMMENT_TEXT] : null; |
||
57 | $comment = $comment.'\n'.__('Refund Request to Bank %1, Agency Number %2, Agency Check Number %3, Account Number %4, Account Check Number %5, Holder Name %6, Holder Tax Document %7', $bankNumber, $agencyNumber, $agencyCheckNumber, $accountNumber, $accountCheckNumber, $holderFullname, $holderDocumment); |
||
58 | $creditmemo->setComment($comment); |
||
59 | } |
||
60 | |||
61 | return $this; |
||
62 | } |
||
64 |
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