| Conditions | 1 |
| Paths | 1 |
| Total Lines | 70 |
| Code Lines | 55 |
| 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 declare(strict_types=1); |
||
| 168 | private function createOrder(string $customerId, array $additionalData = []): void |
||
| 169 | { |
||
| 170 | $this->getContainer()->get('order.repository')->create([ |
||
| 171 | array_merge([ |
||
| 172 | 'id' => $this->ids->create('order'), |
||
| 173 | 'itemRounding' => json_decode(json_encode(new CashRoundingConfig(2, 0.01, true), \JSON_THROW_ON_ERROR), true, 512, \JSON_THROW_ON_ERROR), |
||
| 174 | 'totalRounding' => json_decode(json_encode(new CashRoundingConfig(2, 0.01, true), \JSON_THROW_ON_ERROR), true, 512, \JSON_THROW_ON_ERROR), |
||
| 175 | 'orderDateTime' => (new \DateTimeImmutable())->format(Defaults::STORAGE_DATE_TIME_FORMAT), |
||
| 176 | 'price' => new CartPrice(10, 10, 10, new CalculatedTaxCollection(), new TaxRuleCollection(), CartPrice::TAX_STATE_NET), |
||
| 177 | 'shippingCosts' => new CalculatedPrice(10, 10, new CalculatedTaxCollection(), new TaxRuleCollection()), |
||
| 178 | 'orderCustomer' => [ |
||
| 179 | 'customerId' => $customerId, |
||
| 180 | 'email' => '[email protected]', |
||
| 181 | 'salutationId' => $this->getValidSalutationId(), |
||
| 182 | 'firstName' => 'Max', |
||
| 183 | 'lastName' => 'Mustermann', |
||
| 184 | ], |
||
| 185 | 'orderNumber' => Uuid::randomHex(), |
||
| 186 | 'stateId' => $this->getStateMachineState(), |
||
| 187 | 'paymentMethodId' => $this->getValidPaymentMethodId(), |
||
| 188 | 'currencyId' => Defaults::CURRENCY, |
||
| 189 | 'currencyFactor' => 1.0, |
||
| 190 | 'salesChannelId' => TestDefaults::SALES_CHANNEL, |
||
| 191 | 'billingAddressId' => $billingAddressId = Uuid::randomHex(), |
||
| 192 | 'addresses' => [ |
||
| 193 | [ |
||
| 194 | 'id' => $billingAddressId, |
||
| 195 | 'salutationId' => $this->getValidSalutationId(), |
||
| 196 | 'firstName' => 'Max', |
||
| 197 | 'lastName' => 'Mustermann', |
||
| 198 | 'street' => 'Ebbinghoff 10', |
||
| 199 | 'zipcode' => '48624', |
||
| 200 | 'city' => 'Schöppingen', |
||
| 201 | 'countryId' => $this->getValidCountryId(), |
||
| 202 | ], |
||
| 203 | ], |
||
| 204 | 'lineItems' => [ |
||
| 205 | [ |
||
| 206 | 'id' => $this->ids->create('line-item'), |
||
| 207 | 'identifier' => $this->ids->create('line-item'), |
||
| 208 | 'quantity' => 1, |
||
| 209 | 'label' => 'label', |
||
| 210 | 'type' => LineItem::CUSTOM_LINE_ITEM_TYPE, |
||
| 211 | 'price' => new CalculatedPrice(200, 200, new CalculatedTaxCollection(), new TaxRuleCollection()), |
||
| 212 | 'priceDefinition' => new QuantityPriceDefinition(200, new TaxRuleCollection(), 2), |
||
| 213 | ], |
||
| 214 | ], |
||
| 215 | 'deliveries' => [ |
||
| 216 | [ |
||
| 217 | 'id' => $this->ids->create('delivery'), |
||
| 218 | 'shippingOrderAddressId' => $this->ids->create('shipping-address'), |
||
| 219 | 'shippingMethodId' => $this->getAvailableShippingMethod()->getId(), |
||
| 220 | 'stateId' => $this->getStateId('open', 'order_delivery.state'), |
||
| 221 | 'trackingCodes' => [], |
||
| 222 | 'shippingDateEarliest' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT), |
||
| 223 | 'shippingDateLatest' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT), |
||
| 224 | 'shippingCosts' => new CalculatedPrice(0, 0, new CalculatedTaxCollection(), new TaxRuleCollection()), |
||
| 225 | 'positions' => [ |
||
| 226 | [ |
||
| 227 | 'id' => $this->ids->create('position'), |
||
| 228 | 'orderLineItemId' => $this->ids->create('line-item'), |
||
| 229 | 'price' => new CalculatedPrice(200, 200, new CalculatedTaxCollection(), new TaxRuleCollection()), |
||
| 230 | ], |
||
| 231 | ], |
||
| 232 | ], |
||
| 233 | ], |
||
| 234 | 'context' => '{}', |
||
| 235 | 'payload' => '{}', |
||
| 236 | ], $additionalData), |
||
| 237 | ], Context::createDefaultContext()); |
||
| 238 | } |
||
| 292 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.