Conditions | 13 |
Paths | 576 |
Total Lines | 67 |
Code Lines | 41 |
Lines | 0 |
Ratio | 0 % |
Changes | 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 |
||
47 | public function sendRequest(PayoneMethod $oPayment, Quote $oQuote, $dAmount = false, $sBirthday = false, $sEmail = false) |
||
48 | { |
||
49 | $this->addParameter('request', 'genericpayment'); |
||
50 | $this->addParameter('add_paydata[action]', 'pre_check'); |
||
51 | |||
52 | $this->addParameter('mode', $oPayment->getOperationMode()); |
||
53 | $this->addParameter('aid', $this->shopHelper->getConfigParam('aid')); // ID of PayOne Sub-Account |
||
54 | $this->addParameter('api_version', '3.10'); |
||
55 | |||
56 | $this->addParameter('clearingtype', $oPayment->getClearingtype()); |
||
57 | $this->addParameter('financingtype', $oPayment->getSubType()); |
||
58 | $this->addParameter('add_paydata[payment_type]', $oPayment->getLongSubType()); |
||
59 | |||
60 | if ($dAmount === false) { |
||
61 | $dAmount = $this->apiHelper->getQuoteAmount($oQuote); |
||
62 | } |
||
63 | $this->addParameter('amount', number_format($dAmount, 2, '.', '') * 100); // add price to request |
||
64 | $this->addParameter('currency', $this->apiHelper->getCurrencyFromQuote($oQuote)); // add currency to request |
||
65 | |||
66 | if ($sEmail === false) { |
||
67 | $sEmail = $oQuote->getCustomerEmail(); |
||
68 | } |
||
69 | $this->addParameter('email', $sEmail); |
||
70 | |||
71 | #if ($sBirthday === false && $oPayment->getData('info_instance')) { |
||
72 | if ($oPayment->getData('info_instance')) { |
||
73 | $sBirthday = $oPayment->getInfoInstance()->getAdditionalInformation('dateofbirth'); |
||
74 | } |
||
75 | if ($sBirthday) { |
||
76 | $this->addParameter('birthday', $sBirthday); |
||
77 | } |
||
78 | |||
79 | $oBilling = $oQuote->getBillingAddress(); |
||
80 | $this->addAddress($oBilling); |
||
81 | |||
82 | if ($oBilling->getCountryId() == 'NL') { |
||
83 | $sTelephone = $oBilling->getTelephone(); |
||
84 | if (empty($sTelephone)) { |
||
85 | $sTelephone = $oPayment->getInfoInstance()->getAdditionalInformation('telephone'); |
||
86 | } |
||
87 | $this->addParameter('telephone', $sTelephone); |
||
88 | } |
||
89 | |||
90 | $this->addParameter('language', $this->shopHelper->getLocale()); |
||
91 | |||
92 | $sIp = $this->environmentHelper->getRemoteIp(); // get remote IP |
||
93 | if ($sIp != '') {// is IP not empty |
||
94 | $this->addParameter('ip', $sIp); // add IP address to the request |
||
95 | } |
||
96 | |||
97 | if ($oPayment->getData('info_instance')) { |
||
98 | $blB2bMode = $oPayment->getInfoInstance()->getAdditionalInformation('b2bmode'); |
||
99 | if (!empty($blB2bMode) && (bool)$blB2bMode === true) { |
||
100 | $this->addParameter('add_paydata[b2b]', 'yes'); |
||
101 | |||
102 | $sTradeRegistryNumber = $oPayment->getInfoInstance()->getAdditionalInformation('trade_registry_number'); |
||
103 | if (!empty($sTradeRegistryNumber)) { |
||
104 | $this->addParameter('add_paydata[company_trade_registry_number]', $sTradeRegistryNumber); |
||
105 | } |
||
106 | $sCompanyUid = $oPayment->getInfoInstance()->getAdditionalInformation('company_uid'); |
||
107 | if (!empty($sCompanyUid)) { |
||
108 | $this->addParameter('add_paydata[company_uid]', $sCompanyUid); |
||
109 | } |
||
110 | } |
||
111 | } |
||
112 | |||
113 | return $this->send($oPayment); |
||
114 | } |
||
116 |
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