Conditions | 12 |
Paths | 14 |
Total Lines | 58 |
Code Lines | 35 |
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 |
||
41 | public function execute($request): void |
||
42 | { |
||
43 | RequestNotSupportedException::assertSupports($this, $request); |
||
44 | |||
45 | $details = ArrayObject::ensureArrayObject($request->getModel()); |
||
46 | |||
47 | if (true === isset($details['payment_mollie_id']) || |
||
48 | true === isset($details['subscription_mollie_id']) || |
||
49 | true === isset($details['order_mollie_id'])) { |
||
50 | return; |
||
51 | } |
||
52 | |||
53 | /** @var TokenInterface $token */ |
||
54 | $token = $request->getToken(); |
||
55 | |||
56 | if (null === $this->tokenFactory) { |
||
57 | throw new RuntimeException(); |
||
58 | } |
||
59 | |||
60 | $notifyToken = $this->tokenFactory->createNotifyToken($token->getGatewayName(), $token->getDetails()); |
||
61 | $refundToken = $this->tokenFactory->createRefundToken($token->getGatewayName(), $token->getDetails()); |
||
62 | |||
63 | $details['webhookUrl'] = $notifyToken->getTargetUrl(); |
||
64 | $details['backurl'] = $token->getTargetUrl(); |
||
65 | |||
66 | if (true === $this->mollieApiClient->isRecurringSubscription()) { |
||
67 | $cancelToken = $this->tokenFactory->createToken( |
||
68 | $token->getGatewayName(), |
||
69 | $token->getDetails(), |
||
70 | 'bitbag_sylius_mollie_plugin_cancel_subscription_mollie', |
||
71 | ['orderId' => $details['metadata']['order_id']] |
||
72 | ); |
||
73 | |||
74 | $details['cancel_token'] = $cancelToken->getHash(); |
||
75 | |||
76 | $this->gateway->execute(new CreateSepaMandate($details)); |
||
77 | $this->gateway->execute(new CreateRecurringSubscription($details)); |
||
78 | } |
||
79 | |||
80 | if (false === $this->mollieApiClient->isRecurringSubscription()) { |
||
81 | $metadata = $details['metadata']; |
||
82 | $metadata['refund_token'] = $refundToken->getHash(); |
||
83 | $details['metadata'] = $metadata; |
||
84 | |||
85 | if (isset($details['metadata']['methodType']) && $details['metadata']['methodType'] === Options::PAYMENT_API) { |
||
86 | if (in_array($details['metadata']['molliePaymentMethods'], Options::getOnlyOrderAPIMethods())) { |
||
87 | throw new \sprintf( |
||
|
|||
88 | 'Method %s is not allowed to use %s', |
||
89 | $details['metadata']['molliePaymentMethods'], |
||
90 | Options::PAYMENT_API |
||
91 | ); |
||
92 | } |
||
93 | |||
94 | $this->gateway->execute(new CreatePayment($details)); |
||
95 | } |
||
96 | |||
97 | if (isset($details['metadata']['methodType']) && $details['metadata']['methodType'] === Options::ORDER_API) { |
||
98 | $this->gateway->execute(new CreateOrder($details)); |
||
99 | } |
||
111 |
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