@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function __toString() |
| 59 | 59 | { |
| 60 | - return (string)$this->name; |
|
| 60 | + return (string) $this->name; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function getId(): int |
| 67 | 67 | { |
| 68 | - return (int)$this->id; |
|
| 68 | + return (int) $this->id; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function getExternalId(): int |
| 85 | 85 | { |
| 86 | - return (int)$this->externalId; |
|
| 86 | + return (int) $this->externalId; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | public function __toString() |
| 72 | 72 | { |
| 73 | - return (string)$this->name; |
|
| 73 | + return (string) $this->name; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function getId(): int |
| 80 | 80 | { |
| 81 | - return (int)$this->id; |
|
| 81 | + return (int) $this->id; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function getExternalId(): string |
| 98 | 98 | { |
| 99 | - return (string)$this->externalId; |
|
| 99 | + return (string) $this->externalId; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function __toString() |
| 59 | 59 | { |
| 60 | - return (string)$this->name; |
|
| 60 | + return (string) $this->name; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function getId(): int |
| 67 | 67 | { |
| 68 | - return (int)$this->id; |
|
| 68 | + return (int) $this->id; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function getExternalId(): int |
| 85 | 85 | { |
| 86 | - return (int)$this->externalId; |
|
| 86 | + return (int) $this->externalId; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function __toString() |
| 59 | 59 | { |
| 60 | - return (string)$this->name; |
|
| 60 | + return (string) $this->name; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function getId(): int |
| 67 | 67 | { |
| 68 | - return (int)$this->id; |
|
| 68 | + return (int) $this->id; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function getExternalId(): int |
| 85 | 85 | { |
| 86 | - return (int)$this->externalId; |
|
| 86 | + return (int) $this->externalId; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function getId(): int |
| 97 | 97 | { |
| 98 | - return (int)$this->id; |
|
| 98 | + return (int) $this->id; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function getIdentifier(): string |
| 115 | 115 | { |
| 116 | - return (string)$this->identifier; |
|
| 116 | + return (string) $this->identifier; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function getType(): string |
| 133 | 133 | { |
| 134 | - return (string)$this->type; |
|
| 134 | + return (string) $this->type; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function getStatus(): string |
| 151 | 151 | { |
| 152 | - return (string)$this->status; |
|
| 152 | + return (string) $this->status; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -373,7 +373,7 @@ |
||
| 373 | 373 | $this->payCode = $payCode; |
| 374 | 374 | $this->setIsoCodeNumeric($payCode); |
| 375 | 375 | |
| 376 | - if($payCode) { |
|
| 376 | + if ($payCode) { |
|
| 377 | 377 | $iso4217 = new ISO4217(); |
| 378 | 378 | $currency = $iso4217->getByNumeric($payCode); |
| 379 | 379 | $this->setIsoCodeAlpha($currency['alpha3']); |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | |
| 407 | 407 | public function __toString() |
| 408 | 408 | { |
| 409 | - return (string)$this->number; |
|
| 409 | + return (string) $this->number; |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | /** |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | |
| 486 | 486 | public function hasManufacturer(ManufacturerInterface $manufacturer) : bool |
| 487 | 487 | { |
| 488 | - return $this->manufacturers->exists(function ($key, ManufacturerInterface $element) use ($manufacturer) { |
|
| 488 | + return $this->manufacturers->exists(function($key, ManufacturerInterface $element) use ($manufacturer) { |
|
| 489 | 489 | return $element->getExternalId() === $manufacturer->getExternalId(); |
| 490 | 490 | }); |
| 491 | 491 | } |
@@ -510,14 +510,14 @@ discard block |
||
| 510 | 510 | $variantGroup = $variantGroup->getExternalId(); |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | - return $this->variantGroups->exists(function ($key, VariantGroupInterface $element) use ($variantGroup) { |
|
| 513 | + return $this->variantGroups->exists(function($key, VariantGroupInterface $element) use ($variantGroup) { |
|
| 514 | 514 | return $element->getExternalId() === $variantGroup; |
| 515 | 515 | }); |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | public function addPrice(PriceInterface $price) : ProductInterface |
| 519 | 519 | { |
| 520 | - if(!$this->prices->contains($price)) { |
|
| 520 | + if (!$this->prices->contains($price)) { |
|
| 521 | 521 | $this->prices->add($price); |
| 522 | 522 | } |
| 523 | 523 | |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | foreach ($prices as $price) { |
| 535 | 535 | $existingPrice = $this->findPrice($price); |
| 536 | 536 | |
| 537 | - if($existingPrice) { |
|
| 537 | + if ($existingPrice) { |
|
| 538 | 538 | $existingPrice->copyProperties($price); |
| 539 | 539 | $existingPrice->setProduct($this); |
| 540 | 540 | $finalPrices[] = $existingPrice; |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | } |
| 547 | 547 | |
| 548 | 548 | foreach ($this->prices as $price) { |
| 549 | - if(!in_array($price, $finalPrices, true)) { |
|
| 549 | + if (!in_array($price, $finalPrices, true)) { |
|
| 550 | 550 | $this->removePrice($price); |
| 551 | 551 | } |
| 552 | 552 | } |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | protected function findPrice(PriceInterface $searchPrice) : ?PriceInterface |
| 568 | 568 | { |
| 569 | 569 | foreach ($this->prices as $price) { |
| 570 | - if($price->getAmount() == $searchPrice->getAmount() && $price->getB2bGroupId() == $searchPrice->getB2bGroupId() && $price->getCurrency()->getId() == $searchPrice->getCurrency()->getId()) { |
|
| 570 | + if ($price->getAmount() == $searchPrice->getAmount() && $price->getB2bGroupId() == $searchPrice->getB2bGroupId() && $price->getCurrency()->getId() == $searchPrice->getCurrency()->getId()) { |
|
| 571 | 571 | return $price; |
| 572 | 572 | } |
| 573 | 573 | } |
@@ -583,18 +583,18 @@ discard block |
||
| 583 | 583 | */ |
| 584 | 584 | public function findPriceByCurrency($currency) : ?PriceInterface |
| 585 | 585 | { |
| 586 | - if($currency instanceof \Money\Currency) { |
|
| 586 | + if ($currency instanceof \Money\Currency) { |
|
| 587 | 587 | $currency = $currency->getCode(); |
| 588 | 588 | } elseif ($currency instanceof CurrencyInterface) { |
| 589 | 589 | $currency = $currency->getIsoCodeAlpha(); |
| 590 | 590 | } |
| 591 | 591 | |
| 592 | - if(!is_string($currency)) { |
|
| 592 | + if (!is_string($currency)) { |
|
| 593 | 593 | throw new \InvalidArgumentException('$currency has to be a string'); |
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | foreach ($this->prices as $price) { |
| 597 | - if($price->getCurrency()->getIsoCodeAlpha() === $currency) { |
|
| 597 | + if ($price->getCurrency()->getIsoCodeAlpha() === $currency) { |
|
| 598 | 598 | return $price; |
| 599 | 599 | } |
| 600 | 600 | } |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | $product = $product->getExternalId(); |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | - return $this->children->exists(function ($key, ProductInterface $element) use ($product) { |
|
| 654 | + return $this->children->exists(function($key, ProductInterface $element) use ($product) { |
|
| 655 | 655 | return $element->getExternalId() === $product; |
| 656 | 656 | }); |
| 657 | 657 | } |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | */ |
| 665 | 665 | public function getId(): int |
| 666 | 666 | { |
| 667 | - return (int)$this->id; |
|
| 667 | + return (int) $this->id; |
|
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | /** |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | */ |
| 683 | 683 | public function getExternalId(): int |
| 684 | 684 | { |
| 685 | - return (int)$this->externalId; |
|
| 685 | + return (int) $this->externalId; |
|
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | /** |
@@ -1078,7 +1078,7 @@ discard block |
||
| 1078 | 1078 | */ |
| 1079 | 1079 | public function getNumber() |
| 1080 | 1080 | { |
| 1081 | - return (string)$this->number; |
|
| 1081 | + return (string) $this->number; |
|
| 1082 | 1082 | } |
| 1083 | 1083 | |
| 1084 | 1084 | /** |
@@ -166,26 +166,26 @@ discard block |
||
| 166 | 166 | { |
| 167 | 167 | $unitPrice = $this->getUnitPrice(); |
| 168 | 168 | |
| 169 | - if(!$unitPrice) { |
|
| 169 | + if (!$unitPrice) { |
|
| 170 | 170 | return null; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $multiplier = BigDecimal::of('100')->exactlyDividedBy(BigDecimal::of('100')->plus($vat)); |
| 174 | 174 | |
| 175 | - return $unitPrice->multiply((string)$multiplier); |
|
| 175 | + return $unitPrice->multiply((string) $multiplier); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | public function getSpecialOfferPriceExclVat(float $vat) : ?Money |
| 179 | 179 | { |
| 180 | 180 | $specialOfferPrice = $this->getSpecialOfferPrice(); |
| 181 | 181 | |
| 182 | - if(!$specialOfferPrice) { |
|
| 182 | + if (!$specialOfferPrice) { |
|
| 183 | 183 | return null; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | $multiplier = BigDecimal::of('100')->exactlyDividedBy(BigDecimal::of('100')->plus($vat)); |
| 187 | 187 | |
| 188 | - return $specialOfferPrice->multiply((string)$multiplier); |
|
| 188 | + return $specialOfferPrice->multiply((string) $multiplier); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | public function getId(): int |
| 195 | 195 | { |
| 196 | - return (int)$this->id; |
|
| 196 | + return (int) $this->id; |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /** |
@@ -283,10 +283,10 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | public function getSpecialOfferPrice() : ?Money |
| 285 | 285 | { |
| 286 | - if(!$this->currency) { |
|
| 286 | + if (!$this->currency) { |
|
| 287 | 287 | return null; |
| 288 | 288 | } |
| 289 | - return DandomainFoundation\createMoney($this->currency->getIsoCodeAlpha(), (int)$this->specialOfferPrice); |
|
| 289 | + return DandomainFoundation\createMoney($this->currency->getIsoCodeAlpha(), (int) $this->specialOfferPrice); |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | /** |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | public function setSpecialOfferPrice(Money $specialOfferPrice) : PriceInterface |
| 297 | 297 | { |
| 298 | 298 | // @todo change type from int to string |
| 299 | - $this->specialOfferPrice = (int)$specialOfferPrice->getAmount(); |
|
| 299 | + $this->specialOfferPrice = (int) $specialOfferPrice->getAmount(); |
|
| 300 | 300 | |
| 301 | 301 | return $this; |
| 302 | 302 | } |
@@ -306,10 +306,10 @@ discard block |
||
| 306 | 306 | */ |
| 307 | 307 | public function getUnitPrice() : ?Money |
| 308 | 308 | { |
| 309 | - if(!$this->currency) { |
|
| 309 | + if (!$this->currency) { |
|
| 310 | 310 | return null; |
| 311 | 311 | } |
| 312 | - return DandomainFoundation\createMoney($this->currency->getIsoCodeAlpha(), (int)$this->unitPrice); |
|
| 312 | + return DandomainFoundation\createMoney($this->currency->getIsoCodeAlpha(), (int) $this->unitPrice); |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | public function setUnitPrice(Money $unitPrice) : PriceInterface |
| 320 | 320 | { |
| 321 | 321 | // @todo change type from int to string |
| 322 | - $this->unitPrice = (int)$unitPrice->getAmount(); |
|
| 322 | + $this->unitPrice = (int) $unitPrice->getAmount(); |
|
| 323 | 323 | |
| 324 | 324 | return $this; |
| 325 | 325 | } |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | |
| 382 | 382 | $multiplier = BigDecimal::of('100')->exactlyDividedBy(BigDecimal::of('100')->plus($this->vatPct)); |
| 383 | 383 | |
| 384 | - return $totalPrice->multiply((string)$multiplier); |
|
| 384 | + return $totalPrice->multiply((string) $multiplier); |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | public function totalPriceWithoutFees() : ?Money |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | $orderLine = $orderLine->getExternalId(); |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | - return $this->orderLines->exists(function ($key, OrderLineInterface $element) use ($orderLine) { |
|
| 430 | + return $this->orderLines->exists(function($key, OrderLineInterface $element) use ($orderLine) { |
|
| 431 | 431 | return $element->getExternalId() === $orderLine; |
| 432 | 432 | }); |
| 433 | 433 | } |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | */ |
| 457 | 457 | public function getTotalPrice() : ?Money |
| 458 | 458 | { |
| 459 | - return $this->createMoney((int)$this->totalPrice); |
|
| 459 | + return $this->createMoney((int) $this->totalPrice); |
|
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | /** |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | */ |
| 476 | 476 | public function getSalesDiscount() : ?Money |
| 477 | 477 | { |
| 478 | - return $this->createMoney((int)$this->salesDiscount); |
|
| 478 | + return $this->createMoney((int) $this->salesDiscount); |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | /** |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | */ |
| 495 | 495 | public function getGiftCertificateAmount() : ?Money |
| 496 | 496 | { |
| 497 | - return $this->createMoney((int)$this->giftCertificateAmount); |
|
| 497 | + return $this->createMoney((int) $this->giftCertificateAmount); |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | /** |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | */ |
| 514 | 514 | public function getShippingMethodFee() : ?Money |
| 515 | 515 | { |
| 516 | - return $this->createMoney((int)$this->shippingMethodFee); |
|
| 516 | + return $this->createMoney((int) $this->shippingMethodFee); |
|
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | /** |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | */ |
| 533 | 533 | public function getPaymentMethodFee() : ?Money |
| 534 | 534 | { |
| 535 | - return $this->createMoney((int)$this->paymentMethodFee); |
|
| 535 | + return $this->createMoney((int) $this->paymentMethodFee); |
|
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | /** |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | */ |
| 552 | 552 | public function getId(): int |
| 553 | 553 | { |
| 554 | - return (int)$this->id; |
|
| 554 | + return (int) $this->id; |
|
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | /** |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | */ |
| 570 | 570 | public function getExternalId(): int |
| 571 | 571 | { |
| 572 | - return (int)$this->externalId; |
|
| 572 | + return (int) $this->externalId; |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | /** |
@@ -1148,7 +1148,7 @@ discard block |
||
| 1148 | 1148 | */ |
| 1149 | 1149 | private function createMoney(int $amount = 0) : ?Money |
| 1150 | 1150 | { |
| 1151 | - if(!$this->currency) { |
|
| 1151 | + if (!$this->currency) { |
|
| 1152 | 1152 | return null; |
| 1153 | 1153 | } |
| 1154 | 1154 | |