This class 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...
11
{
12
/**
13
* @var API
14
*/
15
protected $api;
16
17
/**
18
* Merchant instance.
19
*
20
* @var \EntWeChat\Payment\Merchant
21
*/
22
protected $merchant;
23
24
/**
25
* Constructor.
26
*
27
* @param Merchant $merchant
28
*/
29
public function __construct(Merchant $merchant)
30
{
31
$this->merchant = $merchant;
32
}
33
34
/**
35
* Merchant setter.
36
*
37
* @param Merchant $merchant
38
*/
39
public function setMerchant(Merchant $merchant)
40
{
41
$this->merchant = $merchant;
42
}
43
44
/**
45
* Merchant getter.
46
*
47
* @return Merchant
48
*/
49
public function getMerchant()
50
{
51
return $this->merchant;
52
}
53
54
/**
55
* API setter.
56
*
57
* @param API $api
58
*/
59
public function setAPI(API $api)
60
{
61
$this->api = $api;
62
}
63
64
/**
65
* Return API instance.
66
*
67
* @return API
68
*/
69
public function getAPI()
70
{
71
return $this->api ?: $this->api = new API($this->getMerchant());
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.