| 1 | <?php |
||||||
| 2 | |||||||
| 3 | namespace Loevgaard\DandomainFoundation\Entity; |
||||||
| 4 | |||||||
| 5 | use Brick\Math\BigDecimal; |
||||||
| 6 | use Doctrine\Common\Collections\ArrayCollection; |
||||||
| 7 | use Doctrine\ORM\Mapping as ORM; |
||||||
| 8 | use Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletable; |
||||||
| 9 | use Knp\DoctrineBehaviors\Model\Timestampable\Timestampable; |
||||||
| 10 | use Loevgaard\DandomainFoundation; |
||||||
| 11 | use Loevgaard\DandomainFoundation\Entity\Generated\CurrencyInterface; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 12 | use Loevgaard\DandomainFoundation\Entity\Generated\CustomerInterface; |
||||||
|
0 ignored issues
–
show
The type
Loevgaard\DandomainFound...rated\CustomerInterface was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 13 | use Loevgaard\DandomainFoundation\Entity\Generated\DeliveryInterface; |
||||||
|
0 ignored issues
–
show
The type
Loevgaard\DandomainFound...rated\DeliveryInterface was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 14 | use Loevgaard\DandomainFoundation\Entity\Generated\InvoiceInterface; |
||||||
|
0 ignored issues
–
show
The type
Loevgaard\DandomainFound...erated\InvoiceInterface was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 15 | use Loevgaard\DandomainFoundation\Entity\Generated\OrderInterface; |
||||||
|
0 ignored issues
–
show
The type
Loevgaard\DandomainFound...enerated\OrderInterface was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 16 | use Loevgaard\DandomainFoundation\Entity\Generated\OrderLineInterface; |
||||||
|
0 ignored issues
–
show
The type
Loevgaard\DandomainFound...ated\OrderLineInterface was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 17 | use Loevgaard\DandomainFoundation\Entity\Generated\OrderTrait; |
||||||
|
0 ignored issues
–
show
The type
Loevgaard\DandomainFound...ty\Generated\OrderTrait was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 18 | use Loevgaard\DandomainFoundation\Entity\Generated\PaymentMethodInterface; |
||||||
|
0 ignored issues
–
show
The type
Loevgaard\DandomainFound...\PaymentMethodInterface was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 19 | use Loevgaard\DandomainFoundation\Entity\Generated\ShippingMethodInterface; |
||||||
|
0 ignored issues
–
show
The type
Loevgaard\DandomainFound...ShippingMethodInterface was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 20 | use Loevgaard\DandomainFoundation\Entity\Generated\SiteInterface; |
||||||
|
0 ignored issues
–
show
The type
Loevgaard\DandomainFound...Generated\SiteInterface was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 21 | use Loevgaard\DandomainFoundation\Entity\Generated\StateInterface; |
||||||
|
0 ignored issues
–
show
The type
Loevgaard\DandomainFound...enerated\StateInterface was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 22 | use Money\Money; |
||||||
| 23 | |||||||
| 24 | /** |
||||||
| 25 | * We use the Money library for amounts, and we use a shared currency, namely the property $currencyCode. |
||||||
| 26 | * |
||||||
| 27 | * @ORM\Entity() |
||||||
| 28 | * @ORM\Table(name="ldf_orders", uniqueConstraints={ |
||||||
| 29 | * @ORM\UniqueConstraint(name="external_id", columns={"external_id"}) |
||||||
| 30 | * }) |
||||||
| 31 | */ |
||||||
| 32 | class Order extends AbstractEntity implements OrderInterface |
||||||
| 33 | { |
||||||
| 34 | use OrderTrait; |
||||||
| 35 | use Timestampable; |
||||||
| 36 | use SoftDeletable; |
||||||
| 37 | |||||||
| 38 | protected $hydrateConversions = [ |
||||||
| 39 | 'id' => 'externalId', |
||||||
| 40 | ]; |
||||||
| 41 | |||||||
| 42 | /** |
||||||
| 43 | * @var int |
||||||
| 44 | * |
||||||
| 45 | * @ORM\Id |
||||||
| 46 | * @ORM\GeneratedValue |
||||||
| 47 | * @ORM\Column(type="integer") |
||||||
| 48 | **/ |
||||||
| 49 | protected $id; |
||||||
| 50 | |||||||
| 51 | /** |
||||||
| 52 | * This is the order id in Dandomain. |
||||||
| 53 | * |
||||||
| 54 | * @var int |
||||||
| 55 | * |
||||||
| 56 | * @ORM\Column(type="integer") |
||||||
| 57 | */ |
||||||
| 58 | protected $externalId; |
||||||
| 59 | |||||||
| 60 | /** |
||||||
| 61 | * @var CustomerInterface|null |
||||||
| 62 | * |
||||||
| 63 | * @ORM\JoinColumn(onDelete="SET NULL") |
||||||
| 64 | * @ORM\ManyToOne(targetEntity="Customer", cascade={"persist", "remove"}) |
||||||
| 65 | */ |
||||||
| 66 | protected $customer; |
||||||
| 67 | |||||||
| 68 | /** |
||||||
| 69 | * @var DeliveryInterface|null |
||||||
| 70 | * |
||||||
| 71 | * @ORM\JoinColumn(onDelete="SET NULL") |
||||||
| 72 | * @ORM\ManyToOne(targetEntity="Delivery", cascade={"persist", "remove"}) |
||||||
| 73 | */ |
||||||
| 74 | protected $delivery; |
||||||
| 75 | |||||||
| 76 | /** |
||||||
| 77 | * @var InvoiceInterface|null |
||||||
| 78 | * |
||||||
| 79 | * @ORM\JoinColumn(onDelete="SET NULL") |
||||||
| 80 | * @ORM\ManyToOne(targetEntity="Invoice", cascade={"persist", "remove"}) |
||||||
| 81 | */ |
||||||
| 82 | protected $invoice; |
||||||
| 83 | |||||||
| 84 | /** |
||||||
| 85 | * @var OrderLineInterface[]|ArrayCollection |
||||||
| 86 | * |
||||||
| 87 | * @ORM\OneToMany(mappedBy="order", targetEntity="OrderLine", cascade={"persist", "remove"}, orphanRemoval=true) |
||||||
| 88 | */ |
||||||
| 89 | protected $orderLines; |
||||||
| 90 | |||||||
| 91 | /** |
||||||
| 92 | * @var PaymentMethodInterface|null |
||||||
| 93 | * |
||||||
| 94 | * @ORM\JoinColumn(onDelete="SET NULL") |
||||||
| 95 | * @ORM\ManyToOne(targetEntity="PaymentMethod", cascade={"persist", "remove"}) |
||||||
| 96 | */ |
||||||
| 97 | protected $paymentMethod; |
||||||
| 98 | |||||||
| 99 | /** |
||||||
| 100 | * Because the fee can change on the payment method we have a field for here for the fee on this order. |
||||||
| 101 | * |
||||||
| 102 | * @var int|null |
||||||
| 103 | * |
||||||
| 104 | * @ORM\Column(type="integer", nullable=true) |
||||||
| 105 | */ |
||||||
| 106 | protected $paymentMethodFee; |
||||||
| 107 | |||||||
| 108 | /** |
||||||
| 109 | * @var ShippingMethodInterface|null |
||||||
| 110 | * |
||||||
| 111 | * @ORM\JoinColumn(onDelete="SET NULL") |
||||||
| 112 | * @ORM\ManyToOne(targetEntity="ShippingMethod", cascade={"persist", "remove"}) |
||||||
| 113 | */ |
||||||
| 114 | protected $shippingMethod; |
||||||
| 115 | |||||||
| 116 | /** |
||||||
| 117 | * Because the fee can change on the shipping method we have a field for here for the fee on this order. |
||||||
| 118 | * |
||||||
| 119 | * @var int|null |
||||||
| 120 | * |
||||||
| 121 | * @ORM\Column(type="integer", nullable=true) |
||||||
| 122 | */ |
||||||
| 123 | protected $shippingMethodFee; |
||||||
| 124 | |||||||
| 125 | /** |
||||||
| 126 | * @var SiteInterface|null |
||||||
| 127 | * |
||||||
| 128 | * @ORM\JoinColumn(onDelete="SET NULL") |
||||||
| 129 | * @ORM\ManyToOne(targetEntity="Site", cascade={"persist", "remove"}) |
||||||
| 130 | */ |
||||||
| 131 | protected $site; |
||||||
| 132 | |||||||
| 133 | /** |
||||||
| 134 | * @var StateInterface|null |
||||||
| 135 | * |
||||||
| 136 | * @ORM\JoinColumn(onDelete="SET NULL") |
||||||
| 137 | * @ORM\ManyToOne(targetEntity="State", cascade={"persist", "remove"}) |
||||||
| 138 | */ |
||||||
| 139 | protected $state; |
||||||
| 140 | |||||||
| 141 | /** |
||||||
| 142 | * @var string|null |
||||||
| 143 | * |
||||||
| 144 | * @ORM\Column(nullable=true, type="text") |
||||||
| 145 | */ |
||||||
| 146 | protected $comment; |
||||||
| 147 | |||||||
| 148 | /** |
||||||
| 149 | * @var \DateTimeImmutable|null |
||||||
| 150 | * |
||||||
| 151 | * @ORM\Column(nullable=true, type="datetime_immutable", options={"comment"="Created info from Dandomain"}) |
||||||
| 152 | */ |
||||||
| 153 | protected $createdDate; |
||||||
| 154 | |||||||
| 155 | /** |
||||||
| 156 | * @var string|null |
||||||
| 157 | * |
||||||
| 158 | * @ORM\Column(nullable=true, type="string", length=191) |
||||||
| 159 | */ |
||||||
| 160 | protected $creditNoteNumber; |
||||||
| 161 | |||||||
| 162 | /** |
||||||
| 163 | * The currency code in the Dandomain API refers in fact to the currencies' field named 'id' or 'code' |
||||||
| 164 | * Therefore we don't have a currencyCode property, but a currency property. |
||||||
| 165 | * |
||||||
| 166 | * @var CurrencyInterface|null |
||||||
| 167 | * |
||||||
| 168 | * @ORM\ManyToOne(targetEntity="Currency") |
||||||
| 169 | * @ORM\JoinColumn(nullable=false) |
||||||
| 170 | */ |
||||||
| 171 | protected $currency; |
||||||
| 172 | |||||||
| 173 | /** |
||||||
| 174 | * @var string|null |
||||||
| 175 | * |
||||||
| 176 | * @ORM\Column(nullable=true, type="text") |
||||||
| 177 | */ |
||||||
| 178 | protected $customerComment; |
||||||
| 179 | |||||||
| 180 | /** |
||||||
| 181 | * @var int|null |
||||||
| 182 | * |
||||||
| 183 | * @ORM\Column(type="integer", nullable=true) |
||||||
| 184 | */ |
||||||
| 185 | protected $giftCertificateAmount; |
||||||
| 186 | |||||||
| 187 | /** |
||||||
| 188 | * @var string|null |
||||||
| 189 | * |
||||||
| 190 | * @ORM\Column(nullable=true, type="string", length=191) |
||||||
| 191 | */ |
||||||
| 192 | protected $giftCertificateNumber; |
||||||
| 193 | |||||||
| 194 | /** |
||||||
| 195 | * @var bool|null |
||||||
| 196 | * |
||||||
| 197 | * @ORM\Column(type="boolean", nullable=true) |
||||||
| 198 | */ |
||||||
| 199 | protected $incomplete; |
||||||
| 200 | |||||||
| 201 | /** |
||||||
| 202 | * @var string|null |
||||||
| 203 | * |
||||||
| 204 | * @ORM\Column(nullable=true, type="string", length=191) |
||||||
| 205 | */ |
||||||
| 206 | protected $ip; |
||||||
| 207 | |||||||
| 208 | /** |
||||||
| 209 | * @var bool|null |
||||||
| 210 | * |
||||||
| 211 | * @ORM\Column(type="boolean", nullable=true) |
||||||
| 212 | */ |
||||||
| 213 | protected $modified; |
||||||
| 214 | |||||||
| 215 | /** |
||||||
| 216 | * @var \DateTimeImmutable|null |
||||||
| 217 | * |
||||||
| 218 | * @ORM\Column(nullable=true, type="datetime_immutable", options={"comment"="Modified info from Dandomain"}) |
||||||
| 219 | */ |
||||||
| 220 | protected $modifiedDate; |
||||||
| 221 | |||||||
| 222 | /** |
||||||
| 223 | * @var string|null |
||||||
| 224 | * |
||||||
| 225 | * @ORM\Column(nullable=true, type="string", length=191) |
||||||
| 226 | */ |
||||||
| 227 | protected $referenceNumber; |
||||||
| 228 | |||||||
| 229 | /** |
||||||
| 230 | * @var string|null |
||||||
| 231 | * |
||||||
| 232 | * @ORM\Column(nullable=true, type="text") |
||||||
| 233 | */ |
||||||
| 234 | protected $referrer; |
||||||
| 235 | |||||||
| 236 | /** |
||||||
| 237 | * @var string|null |
||||||
| 238 | * |
||||||
| 239 | * @ORM\Column(nullable=true, type="string", length=191) |
||||||
| 240 | */ |
||||||
| 241 | protected $reservedField1; |
||||||
| 242 | |||||||
| 243 | /** |
||||||
| 244 | * @var string|null |
||||||
| 245 | * |
||||||
| 246 | * @ORM\Column(nullable=true, type="string", length=191) |
||||||
| 247 | */ |
||||||
| 248 | protected $reservedField2; |
||||||
| 249 | |||||||
| 250 | /** |
||||||
| 251 | * @var string|null |
||||||
| 252 | * |
||||||
| 253 | * @ORM\Column(nullable=true, type="string", length=191) |
||||||
| 254 | */ |
||||||
| 255 | protected $reservedField3; |
||||||
| 256 | |||||||
| 257 | /** |
||||||
| 258 | * @var string|null |
||||||
| 259 | * |
||||||
| 260 | * @ORM\Column(nullable=true, type="string", length=191) |
||||||
| 261 | */ |
||||||
| 262 | protected $reservedField4; |
||||||
| 263 | |||||||
| 264 | /** |
||||||
| 265 | * @var string|null |
||||||
| 266 | * |
||||||
| 267 | * @ORM\Column(nullable=true, type="string", length=191) |
||||||
| 268 | */ |
||||||
| 269 | protected $reservedField5; |
||||||
| 270 | |||||||
| 271 | /** |
||||||
| 272 | * @var int|null |
||||||
| 273 | * |
||||||
| 274 | * @ORM\Column(type="integer", nullable=true) |
||||||
| 275 | */ |
||||||
| 276 | protected $salesDiscount; |
||||||
| 277 | |||||||
| 278 | /** |
||||||
| 279 | * This price is incl vat. |
||||||
| 280 | * |
||||||
| 281 | * @var int|null |
||||||
| 282 | * |
||||||
| 283 | * @ORM\Column(type="integer", nullable=true) |
||||||
| 284 | */ |
||||||
| 285 | protected $totalPrice; |
||||||
| 286 | |||||||
| 287 | /** |
||||||
| 288 | * @var float|null |
||||||
| 289 | * |
||||||
| 290 | * @ORM\Column(nullable=true, type="decimal", precision=12, scale=2) |
||||||
| 291 | */ |
||||||
| 292 | protected $totalWeight; |
||||||
| 293 | |||||||
| 294 | /** |
||||||
| 295 | * @var string|null |
||||||
| 296 | * |
||||||
| 297 | * @ORM\Column(nullable=true, type="string", length=191) |
||||||
| 298 | */ |
||||||
| 299 | protected $trackingNumber; |
||||||
| 300 | |||||||
| 301 | /** |
||||||
| 302 | * @var int|null |
||||||
| 303 | * |
||||||
| 304 | * @ORM\Column(nullable=true, type="string", length=191) |
||||||
| 305 | */ |
||||||
| 306 | protected $transactionNumber; |
||||||
| 307 | |||||||
| 308 | /** |
||||||
| 309 | * @var float|null |
||||||
| 310 | * |
||||||
| 311 | * @ORM\Column(nullable=true, type="decimal", precision=5, scale=2) |
||||||
| 312 | */ |
||||||
| 313 | protected $vatPct; |
||||||
| 314 | |||||||
| 315 | /** |
||||||
| 316 | * @var string|null |
||||||
| 317 | * |
||||||
| 318 | * @ORM\Column(nullable=true, type="string", length=191) |
||||||
| 319 | */ |
||||||
| 320 | protected $vatRegNumber; |
||||||
| 321 | |||||||
| 322 | /** |
||||||
| 323 | * @var string|null |
||||||
| 324 | * |
||||||
| 325 | * @ORM\Column(nullable=true, type="text") |
||||||
| 326 | */ |
||||||
| 327 | protected $xmlParams; |
||||||
| 328 | |||||||
| 329 | 33 | public function __construct() |
|||||
| 330 | { |
||||||
| 331 | 33 | $this->orderLines = new ArrayCollection(); |
|||||
| 332 | 33 | } |
|||||
| 333 | |||||||
| 334 | 3 | public function hydrate(array $data, bool $useConversions = false, $scalarsOnly = true) |
|||||
| 335 | { |
||||||
| 336 | 3 | $currency = $data['currencyCode']; |
|||||
| 337 | |||||||
| 338 | 3 | if (isset($data['totalPrice'])) { |
|||||
| 339 | 3 | $data['totalPrice'] = DandomainFoundation\createMoneyFromFloat($currency, $data['totalPrice']); |
|||||
|
0 ignored issues
–
show
The function
createMoneyFromFloat was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 340 | } |
||||||
| 341 | |||||||
| 342 | 3 | if (isset($data['giftCertificateAmount'])) { |
|||||
| 343 | 3 | $data['giftCertificateAmount'] = DandomainFoundation\createMoneyFromFloat($currency, $data['giftCertificateAmount']); |
|||||
| 344 | } |
||||||
| 345 | |||||||
| 346 | 3 | if (isset($data['salesDiscount'])) { |
|||||
| 347 | 3 | $data['salesDiscount'] = DandomainFoundation\createMoneyFromFloat($currency, $data['salesDiscount']); |
|||||
| 348 | } |
||||||
| 349 | |||||||
| 350 | 3 | if (isset($data['paymentInfo']['fee'])) { |
|||||
| 351 | 3 | $data['paymentMethodFee'] = DandomainFoundation\createMoneyFromFloat($currency, $data['paymentInfo']['fee']); |
|||||
| 352 | } |
||||||
| 353 | |||||||
| 354 | 3 | if (isset($data['shippingInfo']['fee'])) { |
|||||
| 355 | 3 | $data['shippingMethodFee'] = DandomainFoundation\createMoneyFromFloat($currency, $data['shippingInfo']['fee']); |
|||||
| 356 | } |
||||||
| 357 | |||||||
| 358 | 3 | if ($data['createdDate']) { |
|||||
| 359 | 3 | $data['createdDate'] = $this->getDateTimeFromJson($data['createdDate']); |
|||||
| 360 | } |
||||||
| 361 | |||||||
| 362 | 3 | if ($data['modifiedDate']) { |
|||||
| 363 | 3 | $data['modifiedDate'] = $this->getDateTimeFromJson($data['modifiedDate']); |
|||||
| 364 | } |
||||||
| 365 | |||||||
| 366 | 3 | parent::hydrate($data, $useConversions, $scalarsOnly); |
|||||
| 367 | 3 | } |
|||||
| 368 | |||||||
| 369 | /* |
||||||
| 370 | * Helper methods |
||||||
| 371 | */ |
||||||
| 372 | public function getTotalPriceInclVat(): ?Money |
||||||
| 373 | { |
||||||
| 374 | return $this->getTotalPrice(); |
||||||
| 375 | } |
||||||
| 376 | |||||||
| 377 | public function getTotalPriceExclVat(): ?Money |
||||||
| 378 | { |
||||||
| 379 | $totalPrice = $this->getTotalPrice(); |
||||||
| 380 | if (!$totalPrice) { |
||||||
| 381 | return null; |
||||||
| 382 | } |
||||||
| 383 | |||||||
| 384 | $multiplier = BigDecimal::of('100')->exactlyDividedBy(BigDecimal::of('100')->plus($this->vatPct)); |
||||||
|
0 ignored issues
–
show
The method
exactlyDividedBy() does not exist on Brick\Math\BigRational.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
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. Loading history...
The method
exactlyDividedBy() does not exist on Brick\Math\BigInteger.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
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. Loading history...
|
|||||||
| 385 | |||||||
| 386 | return $totalPrice->multiply((string) $multiplier); |
||||||
| 387 | } |
||||||
| 388 | |||||||
| 389 | public function totalPriceWithoutFees(): ?Money |
||||||
| 390 | { |
||||||
| 391 | $totalPrice = $this->getTotalPrice(); |
||||||
| 392 | if (!$totalPrice) { |
||||||
| 393 | return null; |
||||||
| 394 | } |
||||||
| 395 | |||||||
| 396 | $paymentMethodFee = $this->getPaymentMethodFee(); |
||||||
| 397 | if ($paymentMethodFee) { |
||||||
| 398 | $totalPrice = $totalPrice->subtract($paymentMethodFee); |
||||||
| 399 | } |
||||||
| 400 | |||||||
| 401 | $shippingMethodFee = $this->getShippingMethodFee(); |
||||||
| 402 | if ($shippingMethodFee) { |
||||||
| 403 | $totalPrice = $totalPrice->subtract($shippingMethodFee); |
||||||
| 404 | } |
||||||
| 405 | |||||||
| 406 | return $totalPrice; |
||||||
| 407 | } |
||||||
| 408 | |||||||
| 409 | /* |
||||||
| 410 | * Collection methods |
||||||
| 411 | */ |
||||||
| 412 | 15 | public function addOrderLine(OrderLineInterface $orderLine): OrderInterface |
|||||
| 413 | { |
||||||
| 414 | 15 | if (!$this->hasOrderLine($orderLine)) { |
|||||
| 415 | 15 | $this->orderLines->add($orderLine); |
|||||
| 416 | 15 | $orderLine->setOrder($this); |
|||||
| 417 | } |
||||||
| 418 | |||||||
| 419 | 15 | return $this; |
|||||
| 420 | } |
||||||
| 421 | |||||||
| 422 | /** |
||||||
| 423 | * @param OrderLineInterface|int $orderLine Either the OrderLineInterface or the external id |
||||||
| 424 | * |
||||||
| 425 | 10 | * @return bool |
|||||
| 426 | */ |
||||||
| 427 | 15 | public function hasOrderLine($orderLine): bool |
|||||
| 428 | 10 | { |
|||||
| 429 | 5 | if ($orderLine instanceof OrderLineInterface) { |
|||||
| 430 | 5 | $orderLine = $orderLine->getExternalId(); |
|||||
| 431 | 10 | } |
|||||
| 432 | 6 | ||||||
| 433 | 15 | return $this->orderLines->exists(function ($key, OrderLineInterface $element) use ($orderLine) { |
|||||
| 434 | 3 | return $element->getExternalId() === $orderLine; |
|||||
| 435 | 5 | }); |
|||||
| 436 | 2 | } |
|||||
| 437 | |||||||
| 438 | 3 | public function removeOrderLine(OrderLineInterface $orderLine): OrderInterface |
|||||
| 439 | 2 | { |
|||||
| 440 | 1 | $orderLine->setOrder(null); |
|||||
| 441 | 3 | $this->orderLines->removeElement($orderLine); |
|||||
| 442 | |||||||
| 443 | 1 | return $this; |
|||||
| 444 | 2 | } |
|||||
| 445 | |||||||
| 446 | 3 | public function clearOrderLines(): OrderInterface |
|||||
| 447 | 2 | { |
|||||
| 448 | 1 | foreach ($this->orderLines as $orderLine) { |
|||||
| 449 | 1 | $orderLine->setOrder(null); |
|||||
| 450 | 2 | } |
|||||
| 451 | |||||||
| 452 | 3 | $this->orderLines->clear(); |
|||||
| 453 | |||||||
| 454 | 1 | return $this; |
|||||
| 455 | } |
||||||
| 456 | |||||||
| 457 | /** |
||||||
| 458 | * @param OrderLineInterface[] $orderLines |
||||||
| 459 | */ |
||||||
| 460 | public function updateOrderLines(array $orderLines): void |
||||||
| 461 | { |
||||||
| 462 | // this holds the final array of order lines, whether updated or added |
||||||
| 463 | $final = []; |
||||||
| 464 | foreach ($orderLines as $orderLine) { |
||||||
| 465 | $existing = $this->findOrderLine($orderLine); |
||||||
| 466 | if ($existing) { |
||||||
| 467 | $existing->copyProperties($orderLine); |
||||||
| 468 | $existing->setOrder($this); |
||||||
| 469 | $final[] = $existing; |
||||||
| 470 | } else { |
||||||
| 471 | $this->addOrderLine($orderLine); |
||||||
| 472 | $final[] = $orderLine; |
||||||
| 473 | } |
||||||
| 474 | } |
||||||
| 475 | |||||||
| 476 | foreach ($this->orderLines as $orderLine) { |
||||||
| 477 | if (!in_array($orderLine, $final, true)) { |
||||||
| 478 | $this->removeOrderLine($orderLine); |
||||||
| 479 | } |
||||||
| 480 | } |
||||||
| 481 | } |
||||||
| 482 | |||||||
| 483 | /* |
||||||
| 484 | * Getters / Setters |
||||||
| 485 | 2 | */ |
|||||
| 486 | |||||||
| 487 | 2 | /** |
|||||
| 488 | * @return Money|null |
||||||
| 489 | */ |
||||||
| 490 | 1 | public function getTotalPrice(): ?Money |
|||||
| 491 | { |
||||||
| 492 | 1 | return $this->createMoney((int) $this->totalPrice); |
|||||
| 493 | 2 | } |
|||||
| 494 | |||||||
| 495 | 2 | /** |
|||||
| 496 | * @param Money $money |
||||||
| 497 | 2 | * |
|||||
| 498 | * @return OrderInterface |
||||||
| 499 | */ |
||||||
| 500 | 3 | public function setTotalPrice(Money $money = null): OrderInterface |
|||||
| 501 | { |
||||||
| 502 | 3 | $this->totalPrice = $money->getAmount(); |
|||||
|
0 ignored issues
–
show
The method
getAmount() does not exist on null.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
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. Loading history...
It seems like
$money->getAmount() of type string is incompatible with the declared type integer|null of property $totalPrice.
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. Loading history...
|
|||||||
| 503 | |||||||
| 504 | 1 | return $this; |
|||||
| 505 | } |
||||||
| 506 | |||||||
| 507 | /** |
||||||
| 508 | 2 | * @return Money|null |
|||||
| 509 | */ |
||||||
| 510 | 3 | public function getSalesDiscount(): ?Money |
|||||
| 511 | { |
||||||
| 512 | 3 | return $this->createMoney((int) $this->salesDiscount); |
|||||
| 513 | } |
||||||
| 514 | |||||||
| 515 | 2 | /** |
|||||
| 516 | * @param Money $money |
||||||
| 517 | 2 | * |
|||||
| 518 | * @return OrderInterface |
||||||
| 519 | */ |
||||||
| 520 | 1 | public function setSalesDiscount(Money $money = null): OrderInterface |
|||||
| 521 | { |
||||||
| 522 | 1 | $this->salesDiscount = $money->getAmount(); |
|||||
|
0 ignored issues
–
show
It seems like
$money->getAmount() of type string is incompatible with the declared type integer|null of property $salesDiscount.
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. Loading history...
|
|||||||
| 523 | 2 | ||||||
| 524 | 1 | return $this; |
|||||
| 525 | 2 | } |
|||||
| 526 | |||||||
| 527 | 2 | /** |
|||||
| 528 | * @return Money|null |
||||||
| 529 | */ |
||||||
| 530 | 3 | public function getGiftCertificateAmount(): ?Money |
|||||
| 531 | { |
||||||
| 532 | 3 | return $this->createMoney((int) $this->giftCertificateAmount); |
|||||
| 533 | } |
||||||
| 534 | |||||||
| 535 | /** |
||||||
| 536 | * @param Money $money |
||||||
| 537 | * |
||||||
| 538 | 2 | * @return OrderInterface |
|||||
| 539 | */ |
||||||
| 540 | 3 | public function setGiftCertificateAmount(Money $money = null): OrderInterface |
|||||
| 541 | { |
||||||
| 542 | 3 | $this->giftCertificateAmount = $money->getAmount(); |
|||||
|
0 ignored issues
–
show
It seems like
$money->getAmount() of type string is incompatible with the declared type integer|null of property $giftCertificateAmount.
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. Loading history...
|
|||||||
| 543 | |||||||
| 544 | 1 | return $this; |
|||||
| 545 | 2 | } |
|||||
| 546 | |||||||
| 547 | 2 | /** |
|||||
| 548 | * @return Money|null |
||||||
| 549 | */ |
||||||
| 550 | 1 | public function getShippingMethodFee(): ?Money |
|||||
| 551 | { |
||||||
| 552 | 1 | return $this->createMoney((int) $this->shippingMethodFee); |
|||||
| 553 | 2 | } |
|||||
| 554 | |||||||
| 555 | 2 | /** |
|||||
| 556 | * @param Money $money |
||||||
| 557 | 2 | * |
|||||
| 558 | * @return OrderInterface |
||||||
| 559 | */ |
||||||
| 560 | 5 | public function setShippingMethodFee(Money $money = null): OrderInterface |
|||||
| 561 | { |
||||||
| 562 | 5 | $this->shippingMethodFee = $money->getAmount(); |
|||||
|
0 ignored issues
–
show
It seems like
$money->getAmount() of type string is incompatible with the declared type integer|null of property $shippingMethodFee.
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. Loading history...
|
|||||||
| 563 | |||||||
| 564 | 1 | return $this; |
|||||
| 565 | } |
||||||
| 566 | |||||||
| 567 | /** |
||||||
| 568 | * @return Money|null |
||||||
| 569 | */ |
||||||
| 570 | 3 | public function getPaymentMethodFee(): ?Money |
|||||
| 571 | { |
||||||
| 572 | 3 | return $this->createMoney((int) $this->paymentMethodFee); |
|||||
| 573 | } |
||||||
| 574 | 2 | ||||||
| 575 | /** |
||||||
| 576 | * @param Money $money |
||||||
| 577 | 4 | * |
|||||
| 578 | * @return OrderInterface |
||||||
| 579 | 4 | */ |
|||||
| 580 | 1 | public function setPaymentMethodFee(Money $money = null): OrderInterface |
|||||
| 581 | { |
||||||
| 582 | 1 | $this->paymentMethodFee = $money->getAmount(); |
|||||
|
0 ignored issues
–
show
It seems like
$money->getAmount() of type string is incompatible with the declared type integer|null of property $paymentMethodFee.
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. Loading history...
|
|||||||
| 583 | |||||||
| 584 | 1 | return $this; |
|||||
| 585 | } |
||||||
| 586 | |||||||
| 587 | 2 | /** |
|||||
| 588 | * @return int |
||||||
| 589 | 2 | */ |
|||||
| 590 | 2 | public function getId(): int |
|||||
| 591 | 2 | { |
|||||
| 592 | 2 | return (int) $this->id; |
|||||
| 593 | } |
||||||
| 594 | |||||||
| 595 | /** |
||||||
| 596 | * @param int $id |
||||||
| 597 | 2 | * |
|||||
| 598 | * @return OrderInterface |
||||||
| 599 | 2 | */ |
|||||
| 600 | 1 | public function setId($id) |
|||||
| 601 | { |
||||||
| 602 | 1 | $this->id = $id; |
|||||
| 603 | |||||||
| 604 | 1 | return $this; |
|||||
| 605 | } |
||||||
| 606 | |||||||
| 607 | 2 | /** |
|||||
| 608 | * @return int |
||||||
| 609 | 2 | */ |
|||||
| 610 | 2 | public function getExternalId(): int |
|||||
| 611 | 2 | { |
|||||
| 612 | 2 | return (int) $this->externalId; |
|||||
| 613 | } |
||||||
| 614 | |||||||
| 615 | /** |
||||||
| 616 | * @param int $externalId |
||||||
| 617 | 2 | * |
|||||
| 618 | * @return OrderInterface |
||||||
| 619 | 2 | */ |
|||||
| 620 | 1 | public function setExternalId($externalId) |
|||||
| 621 | { |
||||||
| 622 | 1 | $this->externalId = $externalId; |
|||||
| 623 | |||||||
| 624 | 1 | return $this; |
|||||
| 625 | } |
||||||
| 626 | |||||||
| 627 | 2 | /** |
|||||
| 628 | * @return CustomerInterface|null |
||||||
| 629 | 2 | */ |
|||||
| 630 | 1 | public function getCustomer() |
|||||
| 631 | 2 | { |
|||||
| 632 | 1 | return $this->customer; |
|||||
| 633 | } |
||||||
| 634 | |||||||
| 635 | /** |
||||||
| 636 | * @param CustomerInterface|null $customer |
||||||
| 637 | 2 | * |
|||||
| 638 | * @return OrderInterface |
||||||
| 639 | 2 | */ |
|||||
| 640 | 1 | public function setCustomer($customer) |
|||||
| 641 | { |
||||||
| 642 | 1 | $this->customer = $customer; |
|||||
| 643 | |||||||
| 644 | 1 | return $this; |
|||||
| 645 | } |
||||||
| 646 | |||||||
| 647 | 2 | /** |
|||||
| 648 | * @return DeliveryInterface|null |
||||||
| 649 | 2 | */ |
|||||
| 650 | 1 | public function getDelivery() |
|||||
| 651 | 2 | { |
|||||
| 652 | 1 | return $this->delivery; |
|||||
| 653 | } |
||||||
| 654 | |||||||
| 655 | /** |
||||||
| 656 | * @param DeliveryInterface|null $delivery |
||||||
| 657 | 8 | * |
|||||
| 658 | * @return OrderInterface |
||||||
| 659 | 8 | */ |
|||||
| 660 | 1 | public function setDelivery($delivery) |
|||||
| 661 | { |
||||||
| 662 | 1 | $this->delivery = $delivery; |
|||||
| 663 | |||||||
| 664 | 1 | return $this; |
|||||
| 665 | } |
||||||
| 666 | |||||||
| 667 | 2 | /** |
|||||
| 668 | * @return InvoiceInterface|null |
||||||
| 669 | 2 | */ |
|||||
| 670 | 1 | public function getInvoice() |
|||||
| 671 | 2 | { |
|||||
| 672 | 1 | return $this->invoice; |
|||||
| 673 | } |
||||||
| 674 | |||||||
| 675 | /** |
||||||
| 676 | * @param InvoiceInterface|null $invoice |
||||||
| 677 | 2 | * |
|||||
| 678 | * @return OrderInterface |
||||||
| 679 | 2 | */ |
|||||
| 680 | 1 | public function setInvoice($invoice) |
|||||
| 681 | { |
||||||
| 682 | 1 | $this->invoice = $invoice; |
|||||
| 683 | |||||||
| 684 | 1 | return $this; |
|||||
| 685 | } |
||||||
| 686 | |||||||
| 687 | 2 | /** |
|||||
| 688 | * @return ArrayCollection|OrderLineInterface[] |
||||||
| 689 | 2 | */ |
|||||
| 690 | 4 | public function getOrderLines() |
|||||
| 691 | 2 | { |
|||||
| 692 | 4 | return $this->orderLines; |
|||||
| 693 | } |
||||||
| 694 | |||||||
| 695 | /** |
||||||
| 696 | * @param ArrayCollection|null $orderLines |
||||||
| 697 | 2 | * |
|||||
| 698 | * @return OrderInterface |
||||||
| 699 | 2 | */ |
|||||
| 700 | 1 | public function setOrderLines($orderLines) |
|||||
| 701 | { |
||||||
| 702 | 1 | $this->orderLines = $orderLines; |
|||||
| 703 | |||||||
| 704 | 1 | return $this; |
|||||
| 705 | } |
||||||
| 706 | |||||||
| 707 | 2 | /** |
|||||
| 708 | * @return PaymentMethodInterface|null |
||||||
| 709 | 2 | */ |
|||||
| 710 | 1 | public function getPaymentMethod() |
|||||
| 711 | 2 | { |
|||||
| 712 | 1 | return $this->paymentMethod; |
|||||
| 713 | } |
||||||
| 714 | |||||||
| 715 | /** |
||||||
| 716 | * @param PaymentMethodInterface|null $paymentMethod |
||||||
| 717 | 2 | * |
|||||
| 718 | * @return OrderInterface |
||||||
| 719 | 2 | */ |
|||||
| 720 | 1 | public function setPaymentMethod($paymentMethod) |
|||||
| 721 | { |
||||||
| 722 | 1 | $this->paymentMethod = $paymentMethod; |
|||||
| 723 | |||||||
| 724 | 1 | return $this; |
|||||
| 725 | } |
||||||
| 726 | |||||||
| 727 | 2 | /** |
|||||
| 728 | * @return ShippingMethodInterface|null |
||||||
| 729 | 2 | */ |
|||||
| 730 | 1 | public function getShippingMethod() |
|||||
| 731 | 2 | { |
|||||
| 732 | 1 | return $this->shippingMethod; |
|||||
| 733 | } |
||||||
| 734 | |||||||
| 735 | /** |
||||||
| 736 | * @param ShippingMethodInterface|null $shippingMethod |
||||||
| 737 | 2 | * |
|||||
| 738 | * @return OrderInterface |
||||||
| 739 | 2 | */ |
|||||
| 740 | 1 | public function setShippingMethod($shippingMethod) |
|||||
| 741 | { |
||||||
| 742 | 1 | $this->shippingMethod = $shippingMethod; |
|||||
| 743 | |||||||
| 744 | 1 | return $this; |
|||||
| 745 | } |
||||||
| 746 | |||||||
| 747 | 2 | /** |
|||||
| 748 | * @return SiteInterface|null |
||||||
| 749 | 2 | */ |
|||||
| 750 | 1 | public function getSite() |
|||||
| 751 | 2 | { |
|||||
| 752 | 1 | return $this->site; |
|||||
| 753 | } |
||||||
| 754 | |||||||
| 755 | /** |
||||||
| 756 | * @param SiteInterface|null $site |
||||||
| 757 | 2 | * |
|||||
| 758 | * @return OrderInterface |
||||||
| 759 | 2 | */ |
|||||
| 760 | 1 | public function setSite($site) |
|||||
| 761 | { |
||||||
| 762 | 1 | $this->site = $site; |
|||||
| 763 | |||||||
| 764 | 1 | return $this; |
|||||
| 765 | } |
||||||
| 766 | |||||||
| 767 | 2 | /** |
|||||
| 768 | * @return StateInterface|null |
||||||
| 769 | 2 | */ |
|||||
| 770 | 1 | public function getState() |
|||||
| 771 | 2 | { |
|||||
| 772 | 1 | return $this->state; |
|||||
| 773 | } |
||||||
| 774 | |||||||
| 775 | /** |
||||||
| 776 | * @param StateInterface|null $state |
||||||
| 777 | 2 | * |
|||||
| 778 | * @return OrderInterface |
||||||
| 779 | 2 | */ |
|||||
| 780 | 1 | public function setState($state) |
|||||
| 781 | { |
||||||
| 782 | 1 | $this->state = $state; |
|||||
| 783 | |||||||
| 784 | 1 | return $this; |
|||||
| 785 | } |
||||||
| 786 | |||||||
| 787 | 2 | /** |
|||||
| 788 | * @return null|string |
||||||
| 789 | 2 | */ |
|||||
| 790 | 1 | public function getComment() |
|||||
| 791 | 2 | { |
|||||
| 792 | 1 | return $this->comment; |
|||||
| 793 | } |
||||||
| 794 | |||||||
| 795 | /** |
||||||
| 796 | * @param null|string $comment |
||||||
| 797 | 2 | * |
|||||
| 798 | * @return OrderInterface |
||||||
| 799 | 2 | */ |
|||||
| 800 | 1 | public function setComment($comment) |
|||||
| 801 | { |
||||||
| 802 | 1 | $this->comment = $comment; |
|||||
| 803 | |||||||
| 804 | 1 | return $this; |
|||||
| 805 | } |
||||||
| 806 | |||||||
| 807 | 2 | /** |
|||||
| 808 | * @return \DateTimeImmutable|null |
||||||
| 809 | 2 | */ |
|||||
| 810 | 1 | public function getCreatedDate() |
|||||
| 811 | 2 | { |
|||||
| 812 | 1 | return $this->createdDate; |
|||||
| 813 | } |
||||||
| 814 | |||||||
| 815 | /** |
||||||
| 816 | * @param \DateTimeImmutable|null $createdDate |
||||||
| 817 | 6 | * |
|||||
| 818 | * @return OrderInterface |
||||||
| 819 | 6 | */ |
|||||
| 820 | 1 | public function setCreatedDate($createdDate) |
|||||
| 821 | { |
||||||
| 822 | 1 | $this->createdDate = $createdDate; |
|||||
| 823 | |||||||
| 824 | 1 | return $this; |
|||||
| 825 | } |
||||||
| 826 | |||||||
| 827 | 8 | /** |
|||||
| 828 | * @return null|string |
||||||
| 829 | 8 | */ |
|||||
| 830 | 1 | public function getCreditNoteNumber() |
|||||
| 831 | 8 | { |
|||||
| 832 | 1 | return $this->creditNoteNumber; |
|||||
| 833 | } |
||||||
| 834 | |||||||
| 835 | /** |
||||||
| 836 | * @param null|string $creditNoteNumber |
||||||
| 837 | 2 | * |
|||||
| 838 | * @return Order |
||||||
| 839 | 2 | */ |
|||||
| 840 | 1 | public function setCreditNoteNumber($creditNoteNumber) |
|||||
| 841 | { |
||||||
| 842 | 1 | $this->creditNoteNumber = $creditNoteNumber; |
|||||
| 843 | |||||||
| 844 | 1 | return $this; |
|||||
| 845 | } |
||||||
| 846 | |||||||
| 847 | 2 | /** |
|||||
| 848 | * @return CurrencyInterface|null |
||||||
| 849 | 2 | */ |
|||||
| 850 | 3 | public function getCurrency() |
|||||
| 851 | 2 | { |
|||||
| 852 | 3 | return $this->currency; |
|||||
| 853 | } |
||||||
| 854 | |||||||
| 855 | /** |
||||||
| 856 | * @param null|CurrencyInterface $currency |
||||||
| 857 | 2 | * |
|||||
| 858 | * @return OrderInterface |
||||||
| 859 | 2 | */ |
|||||
| 860 | 4 | public function setCurrency($currency) |
|||||
| 861 | { |
||||||
| 862 | 4 | $this->currency = $currency; |
|||||
| 863 | |||||||
| 864 | 4 | return $this; |
|||||
| 865 | } |
||||||
| 866 | |||||||
| 867 | 2 | /** |
|||||
| 868 | * @return null|string |
||||||
| 869 | 2 | */ |
|||||
| 870 | 1 | public function getCustomerComment() |
|||||
| 871 | 2 | { |
|||||
| 872 | 1 | return $this->customerComment; |
|||||
| 873 | } |
||||||
| 874 | |||||||
| 875 | /** |
||||||
| 876 | * @param null|string $customerComment |
||||||
| 877 | 2 | * |
|||||
| 878 | * @return OrderInterface |
||||||
| 879 | 2 | */ |
|||||
| 880 | 1 | public function setCustomerComment($customerComment) |
|||||
| 881 | { |
||||||
| 882 | 1 | $this->customerComment = $customerComment; |
|||||
| 883 | |||||||
| 884 | 1 | return $this; |
|||||
| 885 | } |
||||||
| 886 | |||||||
| 887 | 2 | /** |
|||||
| 888 | * @return null|string |
||||||
| 889 | 2 | */ |
|||||
| 890 | 1 | public function getGiftCertificateNumber() |
|||||
| 891 | 2 | { |
|||||
| 892 | 1 | return $this->giftCertificateNumber; |
|||||
| 893 | } |
||||||
| 894 | |||||||
| 895 | /** |
||||||
| 896 | * @param null|string $giftCertificateNumber |
||||||
| 897 | 2 | * |
|||||
| 898 | * @return OrderInterface |
||||||
| 899 | 2 | */ |
|||||
| 900 | 1 | public function setGiftCertificateNumber($giftCertificateNumber) |
|||||
| 901 | { |
||||||
| 902 | 1 | $this->giftCertificateNumber = $giftCertificateNumber; |
|||||
| 903 | |||||||
| 904 | 1 | return $this; |
|||||
| 905 | } |
||||||
| 906 | |||||||
| 907 | 2 | /** |
|||||
| 908 | * @return bool|null |
||||||
| 909 | 2 | */ |
|||||
| 910 | 1 | public function getIncomplete() |
|||||
| 911 | 2 | { |
|||||
| 912 | 1 | return $this->incomplete; |
|||||
| 913 | } |
||||||
| 914 | |||||||
| 915 | /** |
||||||
| 916 | * @param bool|null $incomplete |
||||||
| 917 | 2 | * |
|||||
| 918 | * @return OrderInterface |
||||||
| 919 | 2 | */ |
|||||
| 920 | 1 | public function setIncomplete($incomplete) |
|||||
| 921 | { |
||||||
| 922 | 1 | $this->incomplete = $incomplete; |
|||||
| 923 | |||||||
| 924 | 1 | return $this; |
|||||
| 925 | } |
||||||
| 926 | |||||||
| 927 | 2 | /** |
|||||
| 928 | * @return null|string |
||||||
| 929 | 2 | */ |
|||||
| 930 | 1 | public function getIp() |
|||||
| 931 | 2 | { |
|||||
| 932 | 1 | return $this->ip; |
|||||
| 933 | } |
||||||
| 934 | |||||||
| 935 | /** |
||||||
| 936 | * @param null|string $ip |
||||||
| 937 | 2 | * |
|||||
| 938 | * @return OrderInterface |
||||||
| 939 | 2 | */ |
|||||
| 940 | 1 | public function setIp($ip) |
|||||
| 941 | { |
||||||
| 942 | 1 | $this->ip = $ip; |
|||||
| 943 | |||||||
| 944 | 1 | return $this; |
|||||
| 945 | } |
||||||
| 946 | |||||||
| 947 | 2 | /** |
|||||
| 948 | * @return bool|null |
||||||
| 949 | 2 | */ |
|||||
| 950 | 1 | public function getModified() |
|||||
| 951 | 2 | { |
|||||
| 952 | 1 | return $this->modified; |
|||||
| 953 | } |
||||||
| 954 | |||||||
| 955 | /** |
||||||
| 956 | * @param bool|null $modified |
||||||
| 957 | 2 | * |
|||||
| 958 | * @return OrderInterface |
||||||
| 959 | 2 | */ |
|||||
| 960 | 1 | public function setModified($modified) |
|||||
| 961 | { |
||||||
| 962 | 1 | $this->modified = $modified; |
|||||
| 963 | |||||||
| 964 | 1 | return $this; |
|||||
| 965 | } |
||||||
| 966 | |||||||
| 967 | 2 | /** |
|||||
| 968 | * @return \DateTimeImmutable|null |
||||||
| 969 | 2 | */ |
|||||
| 970 | 1 | public function getModifiedDate() |
|||||
| 971 | 2 | { |
|||||
| 972 | 1 | return $this->modifiedDate; |
|||||
| 973 | } |
||||||
| 974 | |||||||
| 975 | /** |
||||||
| 976 | * @param \DateTimeImmutable|null $modifiedDate |
||||||
| 977 | 2 | * |
|||||
| 978 | * @return OrderInterface |
||||||
| 979 | 2 | */ |
|||||
| 980 | 1 | public function setModifiedDate($modifiedDate) |
|||||
| 981 | { |
||||||
| 982 | 1 | $this->modifiedDate = $modifiedDate; |
|||||
| 983 | |||||||
| 984 | 1 | return $this; |
|||||
| 985 | } |
||||||
| 986 | |||||||
| 987 | 2 | /** |
|||||
| 988 | * @return null|string |
||||||
| 989 | 2 | */ |
|||||
| 990 | 1 | public function getReferenceNumber() |
|||||
| 991 | 2 | { |
|||||
| 992 | 1 | return $this->referenceNumber; |
|||||
| 993 | } |
||||||
| 994 | |||||||
| 995 | /** |
||||||
| 996 | * @param null|string $referenceNumber |
||||||
| 997 | 2 | * |
|||||
| 998 | * @return OrderInterface |
||||||
| 999 | 2 | */ |
|||||
| 1000 | 1 | public function setReferenceNumber($referenceNumber) |
|||||
| 1001 | { |
||||||
| 1002 | 1 | $this->referenceNumber = $referenceNumber; |
|||||
| 1003 | |||||||
| 1004 | 1 | return $this; |
|||||
| 1005 | } |
||||||
| 1006 | |||||||
| 1007 | 2 | /** |
|||||
| 1008 | * @return null|string |
||||||
| 1009 | 2 | */ |
|||||
| 1010 | 1 | public function getReferrer() |
|||||
| 1011 | 2 | { |
|||||
| 1012 | 1 | return $this->referrer; |
|||||
| 1013 | } |
||||||
| 1014 | |||||||
| 1015 | /** |
||||||
| 1016 | * @param null|string $referrer |
||||||
| 1017 | 2 | * |
|||||
| 1018 | * @return OrderInterface |
||||||
| 1019 | 2 | */ |
|||||
| 1020 | 1 | public function setReferrer($referrer) |
|||||
| 1021 | { |
||||||
| 1022 | 1 | $this->referrer = $referrer; |
|||||
| 1023 | |||||||
| 1024 | 1 | return $this; |
|||||
| 1025 | } |
||||||
| 1026 | |||||||
| 1027 | 2 | /** |
|||||
| 1028 | * @return null|string |
||||||
| 1029 | 2 | */ |
|||||
| 1030 | 1 | public function getReservedField1() |
|||||
| 1031 | 2 | { |
|||||
| 1032 | 1 | return $this->reservedField1; |
|||||
| 1033 | } |
||||||
| 1034 | |||||||
| 1035 | /** |
||||||
| 1036 | * @param null|string $reservedField1 |
||||||
| 1037 | 2 | * |
|||||
| 1038 | * @return OrderInterface |
||||||
| 1039 | 2 | */ |
|||||
| 1040 | 1 | public function setReservedField1($reservedField1) |
|||||
| 1041 | { |
||||||
| 1042 | 1 | $this->reservedField1 = $reservedField1; |
|||||
| 1043 | |||||||
| 1044 | 1 | return $this; |
|||||
| 1045 | } |
||||||
| 1046 | |||||||
| 1047 | 2 | /** |
|||||
| 1048 | * @return null|string |
||||||
| 1049 | 2 | */ |
|||||
| 1050 | 1 | public function getReservedField2() |
|||||
| 1051 | 2 | { |
|||||
| 1052 | 1 | return $this->reservedField2; |
|||||
| 1053 | } |
||||||
| 1054 | |||||||
| 1055 | /** |
||||||
| 1056 | * @param null|string $reservedField2 |
||||||
| 1057 | 2 | * |
|||||
| 1058 | * @return OrderInterface |
||||||
| 1059 | 2 | */ |
|||||
| 1060 | 1 | public function setReservedField2($reservedField2) |
|||||
| 1061 | { |
||||||
| 1062 | 1 | $this->reservedField2 = $reservedField2; |
|||||
| 1063 | |||||||
| 1064 | 1 | return $this; |
|||||
| 1065 | } |
||||||
| 1066 | |||||||
| 1067 | 2 | /** |
|||||
| 1068 | * @return null|string |
||||||
| 1069 | 2 | */ |
|||||
| 1070 | 1 | public function getReservedField3() |
|||||
| 1071 | 2 | { |
|||||
| 1072 | 1 | return $this->reservedField3; |
|||||
| 1073 | } |
||||||
| 1074 | |||||||
| 1075 | /** |
||||||
| 1076 | * @param null|string $reservedField3 |
||||||
| 1077 | 2 | * |
|||||
| 1078 | * @return OrderInterface |
||||||
| 1079 | 2 | */ |
|||||
| 1080 | 1 | public function setReservedField3($reservedField3) |
|||||
| 1081 | { |
||||||
| 1082 | 1 | $this->reservedField3 = $reservedField3; |
|||||
| 1083 | |||||||
| 1084 | 1 | return $this; |
|||||
| 1085 | } |
||||||
| 1086 | |||||||
| 1087 | 2 | /** |
|||||
| 1088 | * @return null|string |
||||||
| 1089 | 2 | */ |
|||||
| 1090 | 1 | public function getReservedField4() |
|||||
| 1091 | 2 | { |
|||||
| 1092 | 1 | return $this->reservedField4; |
|||||
| 1093 | } |
||||||
| 1094 | |||||||
| 1095 | /** |
||||||
| 1096 | * @param null|string $reservedField4 |
||||||
| 1097 | 2 | * |
|||||
| 1098 | * @return OrderInterface |
||||||
| 1099 | 2 | */ |
|||||
| 1100 | 1 | public function setReservedField4($reservedField4) |
|||||
| 1101 | { |
||||||
| 1102 | 1 | $this->reservedField4 = $reservedField4; |
|||||
| 1103 | |||||||
| 1104 | 1 | return $this; |
|||||
| 1105 | } |
||||||
| 1106 | |||||||
| 1107 | 2 | /** |
|||||
| 1108 | * @return null|string |
||||||
| 1109 | 2 | */ |
|||||
| 1110 | 1 | public function getReservedField5() |
|||||
| 1111 | 2 | { |
|||||
| 1112 | 1 | return $this->reservedField5; |
|||||
| 1113 | } |
||||||
| 1114 | |||||||
| 1115 | /** |
||||||
| 1116 | * @param null|string $reservedField5 |
||||||
| 1117 | 2 | * |
|||||
| 1118 | * @return OrderInterface |
||||||
| 1119 | 2 | */ |
|||||
| 1120 | 1 | public function setReservedField5($reservedField5) |
|||||
| 1121 | { |
||||||
| 1122 | 1 | $this->reservedField5 = $reservedField5; |
|||||
| 1123 | |||||||
| 1124 | 1 | return $this; |
|||||
| 1125 | } |
||||||
| 1126 | |||||||
| 1127 | 2 | /** |
|||||
| 1128 | * @return float|null |
||||||
| 1129 | 2 | */ |
|||||
| 1130 | 1 | public function getTotalWeight() |
|||||
| 1131 | 2 | { |
|||||
| 1132 | 1 | return $this->totalWeight; |
|||||
| 1133 | } |
||||||
| 1134 | |||||||
| 1135 | /** |
||||||
| 1136 | * @param float|null $totalWeight |
||||||
| 1137 | 2 | * |
|||||
| 1138 | * @return OrderInterface |
||||||
| 1139 | 2 | */ |
|||||
| 1140 | 1 | public function setTotalWeight($totalWeight) |
|||||
| 1141 | { |
||||||
| 1142 | 1 | $this->totalWeight = $totalWeight; |
|||||
| 1143 | |||||||
| 1144 | 1 | return $this; |
|||||
| 1145 | } |
||||||
| 1146 | |||||||
| 1147 | 2 | /** |
|||||
| 1148 | * @return null|string |
||||||
| 1149 | 2 | */ |
|||||
| 1150 | 1 | public function getTrackingNumber() |
|||||
| 1151 | 2 | { |
|||||
| 1152 | 1 | return $this->trackingNumber; |
|||||
| 1153 | } |
||||||
| 1154 | |||||||
| 1155 | /** |
||||||
| 1156 | * @param null|string $trackingNumber |
||||||
| 1157 | 2 | * |
|||||
| 1158 | * @return OrderInterface |
||||||
| 1159 | 2 | */ |
|||||
| 1160 | 1 | public function setTrackingNumber($trackingNumber) |
|||||
| 1161 | { |
||||||
| 1162 | 1 | $this->trackingNumber = $trackingNumber; |
|||||
| 1163 | |||||||
| 1164 | 1 | return $this; |
|||||
| 1165 | } |
||||||
| 1166 | |||||||
| 1167 | 2 | /** |
|||||
| 1168 | * @return int|null |
||||||
| 1169 | 2 | */ |
|||||
| 1170 | 1 | public function getTransactionNumber() |
|||||
| 1171 | 2 | { |
|||||
| 1172 | 1 | return $this->transactionNumber; |
|||||
| 1173 | } |
||||||
| 1174 | |||||||
| 1175 | /** |
||||||
| 1176 | * @param int|null $transactionNumber |
||||||
| 1177 | 2 | * |
|||||
| 1178 | * @return OrderInterface |
||||||
| 1179 | 2 | */ |
|||||
| 1180 | 1 | public function setTransactionNumber($transactionNumber) |
|||||
| 1181 | { |
||||||
| 1182 | 1 | $this->transactionNumber = $transactionNumber; |
|||||
| 1183 | |||||||
| 1184 | 1 | return $this; |
|||||
| 1185 | } |
||||||
| 1186 | |||||||
| 1187 | 2 | /** |
|||||
| 1188 | * @return float|null |
||||||
| 1189 | 2 | */ |
|||||
| 1190 | 1 | public function getVatPct() |
|||||
| 1191 | 2 | { |
|||||
| 1192 | 1 | return $this->vatPct; |
|||||
| 1193 | } |
||||||
| 1194 | |||||||
| 1195 | /** |
||||||
| 1196 | * @param float|null $vatPct |
||||||
| 1197 | 2 | * |
|||||
| 1198 | * @return OrderInterface |
||||||
| 1199 | 2 | */ |
|||||
| 1200 | 1 | public function setVatPct($vatPct) |
|||||
| 1201 | { |
||||||
| 1202 | 1 | $this->vatPct = $vatPct; |
|||||
| 1203 | |||||||
| 1204 | 1 | return $this; |
|||||
| 1205 | } |
||||||
| 1206 | |||||||
| 1207 | 2 | /** |
|||||
| 1208 | * @return null|string |
||||||
| 1209 | 2 | */ |
|||||
| 1210 | 1 | public function getVatRegNumber() |
|||||
| 1211 | 2 | { |
|||||
| 1212 | 1 | return $this->vatRegNumber; |
|||||
| 1213 | } |
||||||
| 1214 | |||||||
| 1215 | /** |
||||||
| 1216 | * @param null|string $vatRegNumber |
||||||
| 1217 | * |
||||||
| 1218 | * @return OrderInterface |
||||||
| 1219 | */ |
||||||
| 1220 | 1 | public function setVatRegNumber($vatRegNumber) |
|||||
| 1221 | { |
||||||
| 1222 | 1 | $this->vatRegNumber = $vatRegNumber; |
|||||
| 1223 | |||||||
| 1224 | 1 | return $this; |
|||||
| 1225 | } |
||||||
| 1226 | |||||||
| 1227 | /** |
||||||
| 1228 | 2 | * @return null|string |
|||||
| 1229 | */ |
||||||
| 1230 | 3 | public function getXmlParams() |
|||||
| 1231 | { |
||||||
| 1232 | 1 | return $this->xmlParams; |
|||||
| 1233 | } |
||||||
| 1234 | 2 | ||||||
| 1235 | /** |
||||||
| 1236 | * @param null|string $xmlParams |
||||||
| 1237 | * |
||||||
| 1238 | * @return OrderInterface |
||||||
| 1239 | */ |
||||||
| 1240 | 1 | public function setXmlParams($xmlParams) |
|||||
| 1241 | { |
||||||
| 1242 | 1 | $this->xmlParams = $xmlParams; |
|||||
| 1243 | |||||||
| 1244 | 1 | return $this; |
|||||
| 1245 | } |
||||||
| 1246 | |||||||
| 1247 | protected function findOrderLine(OrderLineInterface $orderLine): ?OrderLineInterface |
||||||
| 1248 | { |
||||||
| 1249 | foreach ($this->orderLines as $ol) { |
||||||
| 1250 | if ($orderLine->getExternalId() === $ol->getExternalId()) { |
||||||
| 1251 | return $ol; |
||||||
| 1252 | } |
||||||
| 1253 | } |
||||||
| 1254 | |||||||
| 1255 | return null; |
||||||
| 1256 | } |
||||||
| 1257 | |||||||
| 1258 | /** |
||||||
| 1259 | * A helper method for creating a Money object from a float based on the shared currency. |
||||||
| 1260 | * |
||||||
| 1261 | * @param int $amount |
||||||
| 1262 | * |
||||||
| 1263 | * @return Money|null |
||||||
| 1264 | */ |
||||||
| 1265 | 1 | private function createMoney(int $amount = 0): ?Money |
|||||
| 1266 | { |
||||||
| 1267 | 1 | if (!$this->currency) { |
|||||
| 1268 | return null; |
||||||
| 1269 | } |
||||||
| 1270 | |||||||
| 1271 | 1 | return DandomainFoundation\createMoney($this->currency->getIsoCodeAlpha(), $amount); |
|||||
|
0 ignored issues
–
show
The function
createMoney was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 1272 | } |
||||||
| 1273 | } |
||||||
| 1274 |
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