| Conditions | 5 |
| Paths | 4 |
| Total Lines | 52 |
| Code Lines | 42 |
| 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 |
||
| 112 | protected function createFirstDataHashRequestTransfer(RestCheckoutDataTransfer $restCheckoutDataTransfer): FirstDataHashRequestTransfer |
||
| 113 | { |
||
| 114 | $firstDataHashRequestTransfer = new FirstDataHashRequestTransfer(); |
||
| 115 | $firstDataHashRequestTransfer->setMobileMode($this->firstDataConfig->getMobileMode()); |
||
| 116 | $firstDataHashRequestTransfer->setCheckoutOption($this->firstDataConfig->getCheckoutOption()); |
||
| 117 | $firstDataHashRequestTransfer->setLanguage($this->firstDataConfig->getLanguage()); |
||
| 118 | $firstDataHashRequestTransfer->setAssignToken($this->firstDataConfig->getAssignToken()); |
||
| 119 | $firstDataHashRequestTransfer->setTokenType($this->firstDataConfig->getTokenType()); |
||
| 120 | $firstDataHashRequestTransfer->setDeclineHostedDataDuplicates($this->firstDataConfig->getDeclineHostedDataDuplicates()); |
||
| 121 | $firstDataHashRequestTransfer->setTxnType($this->firstDataConfig->getTransactionType()); |
||
| 122 | $firstDataHashRequestTransfer->setTimezone($this->firstDataConfig->getTimezone()); |
||
| 123 | $firstDataHashRequestTransfer->setTxnDateTime((new DateTime())->format($this->firstDataConfig->getDateTimeFormat())); |
||
| 124 | $firstDataHashRequestTransfer->setHashAlgorithm($this->firstDataConfig->getHmacHashAlgo()); |
||
| 125 | $firstDataHashRequestTransfer->setStoreName($this->firstDataConfig->getStoreName()); |
||
| 126 | $firstDataHashRequestTransfer->setAuthenticateTransaction($this->firstDataConfig->getIs3dSecure()); |
||
| 127 | $firstDataHashRequestTransfer->setOid($this->utilTextService->generateRandomString(static::DEFAULT_OID_LENGTH)); |
||
| 128 | $firstDataHashRequestTransfer->setChargeTotal((string)$this->calculateTotal($restCheckoutDataTransfer)); |
||
| 129 | $firstDataHashRequestTransfer->setCurrency( |
||
| 130 | $this->firstDataConfig->getIsoNumberByCode($restCheckoutDataTransfer->getQuoteOrFail()->getCurrencyOrFail()->getCodeOrFail()) |
||
| 131 | ); |
||
| 132 | $firstDataHashRequestTransfer->setCustomerId($restCheckoutDataTransfer->getQuoteOrFail()->getCustomerReference()); |
||
| 133 | $firstDataHashRequestTransfer->setEmail($restCheckoutDataTransfer->getQuoteOrFail()->getCustomerOrFail()->getEmail()); |
||
| 134 | $firstDataHashRequestTransfer->setResponseSuccessURL($this->firstDataConfig->getResponseSuccessUrl()); |
||
| 135 | $firstDataHashRequestTransfer->setResponseFailURL($this->firstDataConfig->getResponseFailUrl()); |
||
| 136 | $firstDataHashRequestTransfer->setTransactionNotificationURL($this->firstDataConfig->getTransactionNotificationUrl()); |
||
| 137 | |||
| 138 | if ($restCheckoutDataTransfer->getQuoteOrFail()->getBillingAddress()) { |
||
| 139 | $fullName = sprintf( |
||
| 140 | '%s %s', |
||
| 141 | $restCheckoutDataTransfer->getQuoteOrFail()->getBillingAddressOrFail()->getFirstName() ?: '', |
||
| 142 | $restCheckoutDataTransfer->getQuoteOrFail()->getBillingAddressOrFail()->getLastName() ?: '' |
||
| 143 | ); |
||
| 144 | |||
| 145 | $firstDataHashRequestTransfer->setPhone($restCheckoutDataTransfer->getQuoteOrFail()->getCustomerOrFail()->getPhone()); |
||
| 146 | $firstDataHashRequestTransfer->setBname($fullName); |
||
| 147 | $firstDataHashRequestTransfer->setSname($fullName); |
||
| 148 | $firstDataHashRequestTransfer->setBaddr1($restCheckoutDataTransfer->getQuoteOrFail()->getBillingAddressOrFail()->getAddress1()); |
||
| 149 | $firstDataHashRequestTransfer->setBaddr2($restCheckoutDataTransfer->getQuoteOrFail()->getBillingAddressOrFail()->getAddress2()); |
||
| 150 | $firstDataHashRequestTransfer->setBcity($restCheckoutDataTransfer->getQuoteOrFail()->getBillingAddressOrFail()->getCity()); |
||
| 151 | $firstDataHashRequestTransfer->setBzip($restCheckoutDataTransfer->getQuoteOrFail()->getBillingAddressOrFail()->getZipCode()); |
||
| 152 | $firstDataHashRequestTransfer->setBcountry($restCheckoutDataTransfer->getQuoteOrFail()->getBillingAddressOrFail()->getIso2Code()); |
||
| 153 | } |
||
| 154 | |||
| 155 | if ($restCheckoutDataTransfer->getQuoteOrFail()->getShippingAddress()) { |
||
| 156 | $firstDataHashRequestTransfer->setSaddr1($restCheckoutDataTransfer->getQuoteOrFail()->getShippingAddressOrFail()->getAddress1()); |
||
| 157 | $firstDataHashRequestTransfer->setSaddr2($restCheckoutDataTransfer->getQuoteOrFail()->getShippingAddressOrFail()->getAddress2()); |
||
| 158 | $firstDataHashRequestTransfer->setSzip($restCheckoutDataTransfer->getQuoteOrFail()->getShippingAddressOrFail()->getZipCode()); |
||
| 159 | $firstDataHashRequestTransfer->setScity($restCheckoutDataTransfer->getQuoteOrFail()->getShippingAddressOrFail()->getCity()); |
||
| 160 | $firstDataHashRequestTransfer->setScountry($restCheckoutDataTransfer->getQuoteOrFail()->getShippingAddressOrFail()->getIso2Code()); |
||
| 161 | } |
||
| 162 | |||
| 163 | return $firstDataHashRequestTransfer; |
||
| 164 | } |
||
| 182 |
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