@@ -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 | /** |