1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Loevgaard\DandomainFoundation\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\ShippingMethodInterface; |
|
|
|
|
7
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\ShippingMethodTrait; |
|
|
|
|
8
|
|
|
use Money\Currency; |
|
|
|
|
9
|
|
|
use Money\Money; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* @ORM\Entity() |
13
|
|
|
* @ORM\Table(name="ldf_shipping_methods") |
14
|
|
|
*/ |
15
|
|
|
class ShippingMethod extends AbstractEntity implements ShippingMethodInterface |
16
|
|
|
{ |
17
|
|
|
use ShippingMethodTrait; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @var int |
21
|
|
|
* |
22
|
|
|
* @ORM\Id |
23
|
|
|
* @ORM\GeneratedValue |
24
|
|
|
* @ORM\Column(type="integer") |
25
|
|
|
**/ |
26
|
|
|
protected $id; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var int |
30
|
|
|
* |
31
|
|
|
* @ORM\Column(type="integer", unique=true) |
32
|
|
|
*/ |
33
|
|
|
protected $externalId; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var string|null |
37
|
|
|
* |
38
|
|
|
* @ORM\Column(nullable=true, type="string", length=3) |
39
|
|
|
*/ |
40
|
|
|
protected $feeCurrency; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var int|null |
44
|
|
|
* |
45
|
|
|
* @ORM\Column(nullable=true, type="integer") |
46
|
|
|
*/ |
47
|
|
|
protected $feeAmount; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var bool|null |
51
|
|
|
* |
52
|
|
|
* @ORM\Column(nullable=true, type="boolean") |
53
|
|
|
*/ |
54
|
|
|
protected $feeInclVat; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @var string|null |
58
|
|
|
* |
59
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
60
|
|
|
*/ |
61
|
|
|
protected $name; |
62
|
|
|
|
63
|
|
|
public function __toString() |
64
|
|
|
{ |
65
|
|
|
return (string) $this->name; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return int |
70
|
|
|
*/ |
71
|
|
|
public function getId(): int |
72
|
|
|
{ |
73
|
|
|
return (int) $this->id; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @param int $id |
78
|
|
|
* |
79
|
|
|
* @return ShippingMethodInterface |
80
|
|
|
*/ |
81
|
|
|
public function setId($id) |
82
|
|
|
{ |
83
|
|
|
$this->id = $id; |
84
|
|
|
|
85
|
|
|
return $this; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @return int |
90
|
|
|
*/ |
91
|
|
|
public function getExternalId(): int |
92
|
|
|
{ |
93
|
|
|
return (int) $this->externalId; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @param int $externalId |
98
|
|
|
* |
99
|
|
|
* @return ShippingMethodInterface |
100
|
|
|
*/ |
101
|
|
|
public function setExternalId($externalId) |
102
|
|
|
{ |
103
|
|
|
$this->externalId = $externalId; |
104
|
|
|
|
105
|
|
|
return $this; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @return Money|null |
110
|
|
|
*/ |
111
|
|
|
public function getFee(): ?Money |
112
|
|
|
{ |
113
|
|
|
if (!$this->feeCurrency) { |
114
|
|
|
return null; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
return new Money($this->feeAmount, new Currency($this->feeCurrency)); |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @param Money $money |
122
|
|
|
* |
123
|
|
|
* @return ShippingMethodInterface |
124
|
|
|
*/ |
125
|
|
|
public function setFee(Money $money): ShippingMethodInterface |
126
|
|
|
{ |
127
|
|
|
$this->feeAmount = $money->getAmount(); |
|
|
|
|
128
|
|
|
$this->feeCurrency = $money->getCurrency()->getCode(); |
129
|
|
|
|
130
|
|
|
return $this; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @return bool|null |
135
|
|
|
*/ |
136
|
|
|
public function getFeeInclVat() |
137
|
|
|
{ |
138
|
|
|
return $this->feeInclVat; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @param bool|null $feeInclVat |
143
|
|
|
* |
144
|
|
|
* @return ShippingMethodInterface |
145
|
|
|
*/ |
146
|
|
|
public function setFeeInclVat($feeInclVat) |
147
|
|
|
{ |
148
|
|
|
$this->feeInclVat = $feeInclVat; |
149
|
|
|
|
150
|
|
|
return $this; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* @return null|string |
155
|
|
|
*/ |
156
|
|
|
public function getName() |
157
|
|
|
{ |
158
|
|
|
return $this->name; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* @param null|string $name |
163
|
|
|
* |
164
|
|
|
* @return ShippingMethodInterface |
165
|
|
|
*/ |
166
|
|
|
public function setName($name) |
167
|
|
|
{ |
168
|
|
|
$this->name = $name; |
169
|
|
|
|
170
|
|
|
return $this; |
171
|
|
|
} |
172
|
|
|
} |
173
|
|
|
|
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