This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
26
{
27
$e = new static($message);
28
$e->setRequest($request);
29
$e->setPayment($payment);
30
return $e;
31
}
32
33
/**
34
* @return Request
35
*/
36
public function getRequest(): Request
37
{
38
return $this->request;
39
}
40
41
/**
42
* @param Request $request
43
* @return PaymentException
44
*/
45
public function setRequest(Request $request) : PaymentException
You have injected the Request via parameter $request. This is generally not recommended as there might be multiple instances during a request cycle (f.e. when using sub-requests). Instead, it is recommended to inject the RequestStack and retrieve the current request each time you need it via getCurrentRequest().
Loading history...
46
{
47
$this->request = $request;
48
return $this;
49
}
50
51
/**
52
* @return PaymentInterface
53
*/
54
public function getPayment() : PaymentInterface
55
{
56
return $this->payment;
57
}
58
59
/**
60
* @param PaymentInterface $payment
61
* @return PaymentException
62
*/
63
public function setPayment(PaymentInterface $payment) : PaymentException
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.