Conditions | 5 |
Paths | 9 |
Total Lines | 51 |
Code Lines | 25 |
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 |
||
82 | public function aroundBuild( |
||
83 | BoletoPaymentDataRequest $subject, |
||
84 | \Closure $proceed, |
||
85 | $buildSubject |
||
86 | ) { |
||
87 | $result = $proceed($buildSubject); |
||
88 | |||
89 | $paymentDO = $this->subjectReader->readPayment($buildSubject); |
||
90 | |||
91 | $order = $paymentDO->getOrder(); |
||
92 | |||
93 | $storeId = $order->getStoreId(); |
||
94 | |||
95 | $items = $order->getItems(); |
||
96 | |||
97 | $availlable = false; |
||
98 | |||
99 | foreach ($items as $item) { |
||
100 | if ($item->getProduct()->getGetnetSubSellerId()) { |
||
101 | $availlable = true; |
||
102 | } |
||
103 | } |
||
104 | |||
105 | if (!$availlable) { |
||
106 | return $result; |
||
107 | } |
||
108 | |||
109 | $typeDocument = 'CPF'; |
||
110 | |||
111 | $name = $this->splitHelper->getAdditionalGuarantorName($storeId); |
||
112 | |||
113 | $document = $this->splitHelper->getAdditionalGuarantorNumber($storeId); |
||
114 | |||
115 | $document = preg_replace('/[^0-9]/', '', $document); |
||
116 | |||
117 | if (strlen($document) === 14) { |
||
118 | $typeDocument = 'CNPJ'; |
||
119 | } |
||
120 | |||
121 | $addtionalData = [ |
||
122 | self::GUARANTOR_DOCUMENT_TYPE => $typeDocument, |
||
123 | self::GUARANTOR_DOCUMENT_NUMBER => $document, |
||
124 | self::GUARANTOR_NAME => $name, |
||
125 | ]; |
||
126 | |||
127 | $result[BoletoPaymentDataRequest::METHOD] = array_merge( |
||
128 | $result[BoletoPaymentDataRequest::METHOD], |
||
129 | $addtionalData |
||
130 | ); |
||
131 | |||
132 | return $result; |
||
133 | } |
||
135 |
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