@@ -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 | $price->setProduct($this); |
| 523 | 523 | } |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | foreach ($prices as $price) { |
| 537 | 537 | $existingPrice = $this->findPrice($price); |
| 538 | 538 | |
| 539 | - if($existingPrice) { |
|
| 539 | + if ($existingPrice) { |
|
| 540 | 540 | $existingPrice->copyProperties($price); |
| 541 | 541 | $existingPrice->setProduct($this); |
| 542 | 542 | $finalPrices[] = $existingPrice; |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | foreach ($this->prices as $price) { |
| 551 | - if(!in_array($price, $finalPrices, true)) { |
|
| 551 | + if (!in_array($price, $finalPrices, true)) { |
|
| 552 | 552 | $this->removePrice($price); |
| 553 | 553 | } |
| 554 | 554 | } |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | protected function findPrice(PriceInterface $searchPrice) : ?PriceInterface |
| 570 | 570 | { |
| 571 | 571 | foreach ($this->prices as $price) { |
| 572 | - if($price->getAmount() == $searchPrice->getAmount() && $price->getB2bGroupId() == $searchPrice->getB2bGroupId() && $price->getCurrency()->getId() == $searchPrice->getCurrency()->getId()) { |
|
| 572 | + if ($price->getAmount() == $searchPrice->getAmount() && $price->getB2bGroupId() == $searchPrice->getB2bGroupId() && $price->getCurrency()->getId() == $searchPrice->getCurrency()->getId()) { |
|
| 573 | 573 | return $price; |
| 574 | 574 | } |
| 575 | 575 | } |
@@ -585,18 +585,18 @@ discard block |
||
| 585 | 585 | */ |
| 586 | 586 | public function findPriceByCurrency($currency) : ?PriceInterface |
| 587 | 587 | { |
| 588 | - if($currency instanceof \Money\Currency) { |
|
| 588 | + if ($currency instanceof \Money\Currency) { |
|
| 589 | 589 | $currency = $currency->getCode(); |
| 590 | 590 | } elseif ($currency instanceof CurrencyInterface) { |
| 591 | 591 | $currency = $currency->getIsoCodeAlpha(); |
| 592 | 592 | } |
| 593 | 593 | |
| 594 | - if(!is_string($currency)) { |
|
| 594 | + if (!is_string($currency)) { |
|
| 595 | 595 | throw new \InvalidArgumentException('$currency has to be a string'); |
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | foreach ($this->prices as $price) { |
| 599 | - if($price->getCurrency()->getIsoCodeAlpha() === $currency) { |
|
| 599 | + if ($price->getCurrency()->getIsoCodeAlpha() === $currency) { |
|
| 600 | 600 | return $price; |
| 601 | 601 | } |
| 602 | 602 | } |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | $product = $product->getExternalId(); |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | - return $this->children->exists(function ($key, ProductInterface $element) use ($product) { |
|
| 656 | + return $this->children->exists(function($key, ProductInterface $element) use ($product) { |
|
| 657 | 657 | return $element->getExternalId() === $product; |
| 658 | 658 | }); |
| 659 | 659 | } |
@@ -666,7 +666,7 @@ discard block |
||
| 666 | 666 | */ |
| 667 | 667 | public function getId(): int |
| 668 | 668 | { |
| 669 | - return (int)$this->id; |
|
| 669 | + return (int) $this->id; |
|
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | /** |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | */ |
| 685 | 685 | public function getExternalId(): int |
| 686 | 686 | { |
| 687 | - return (int)$this->externalId; |
|
| 687 | + return (int) $this->externalId; |
|
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | /** |
@@ -1080,7 +1080,7 @@ discard block |
||
| 1080 | 1080 | */ |
| 1081 | 1081 | public function getNumber() |
| 1082 | 1082 | { |
| 1083 | - return (string)$this->number; |
|
| 1083 | + return (string) $this->number; |
|
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | 1086 | /** |