@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | |
418 | 418 | public function __toString() |
419 | 419 | { |
420 | - return (string)$this->number; |
|
420 | + return (string) $this->number; |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | /** |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | Assert::that($this->isDeleted())->true('The external id can only be null if the product is marked as deleted', 'externalId'); |
436 | 436 | } |
437 | 437 | |
438 | - if(!$this->priceLess) { |
|
438 | + if (!$this->priceLess) { |
|
439 | 439 | Assert::that($this->prices->count())->greaterThan(0, 'When the product is not "price less" the product needs to have at least one price'); |
440 | 440 | } |
441 | 441 | } |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | |
501 | 501 | public function hasManufacturer(ManufacturerInterface $manufacturer) : bool |
502 | 502 | { |
503 | - return $this->manufacturers->exists(function ($key, ManufacturerInterface $element) use ($manufacturer) { |
|
503 | + return $this->manufacturers->exists(function($key, ManufacturerInterface $element) use ($manufacturer) { |
|
504 | 504 | return $element->getExternalId() === $manufacturer->getExternalId(); |
505 | 505 | }); |
506 | 506 | } |
@@ -525,14 +525,14 @@ discard block |
||
525 | 525 | $variantGroup = $variantGroup->getExternalId(); |
526 | 526 | } |
527 | 527 | |
528 | - return $this->variantGroups->exists(function ($key, VariantGroupInterface $element) use ($variantGroup) { |
|
528 | + return $this->variantGroups->exists(function($key, VariantGroupInterface $element) use ($variantGroup) { |
|
529 | 529 | return $element->getExternalId() === $variantGroup; |
530 | 530 | }); |
531 | 531 | } |
532 | 532 | |
533 | 533 | public function addPrice(PriceInterface $price) : ProductInterface |
534 | 534 | { |
535 | - if(!$this->prices->contains($price)) { |
|
535 | + if (!$this->prices->contains($price)) { |
|
536 | 536 | $this->prices->add($price); |
537 | 537 | $price->setProduct($this); |
538 | 538 | } |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | foreach ($prices as $price) { |
552 | 552 | $existingPrice = $this->findPrice($price); |
553 | 553 | |
554 | - if($existingPrice) { |
|
554 | + if ($existingPrice) { |
|
555 | 555 | $existingPrice->copyProperties($price); |
556 | 556 | $existingPrice->setProduct($this); |
557 | 557 | $finalPrices[] = $existingPrice; |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | } |
564 | 564 | |
565 | 565 | foreach ($this->prices as $price) { |
566 | - if(!in_array($price, $finalPrices, true)) { |
|
566 | + if (!in_array($price, $finalPrices, true)) { |
|
567 | 567 | $this->removePrice($price); |
568 | 568 | } |
569 | 569 | } |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | protected function findPrice(PriceInterface $searchPrice) : ?PriceInterface |
585 | 585 | { |
586 | 586 | foreach ($this->prices as $price) { |
587 | - if($price->getAmount() == $searchPrice->getAmount() && $price->getB2bGroupId() == $searchPrice->getB2bGroupId() && $price->getCurrency()->getId() == $searchPrice->getCurrency()->getId()) { |
|
587 | + if ($price->getAmount() == $searchPrice->getAmount() && $price->getB2bGroupId() == $searchPrice->getB2bGroupId() && $price->getCurrency()->getId() == $searchPrice->getCurrency()->getId()) { |
|
588 | 588 | return $price; |
589 | 589 | } |
590 | 590 | } |
@@ -600,18 +600,18 @@ discard block |
||
600 | 600 | */ |
601 | 601 | public function findPriceByCurrency($currency) : ?PriceInterface |
602 | 602 | { |
603 | - if($currency instanceof \Money\Currency) { |
|
603 | + if ($currency instanceof \Money\Currency) { |
|
604 | 604 | $currency = $currency->getCode(); |
605 | 605 | } elseif ($currency instanceof CurrencyInterface) { |
606 | 606 | $currency = $currency->getIsoCodeAlpha(); |
607 | 607 | } |
608 | 608 | |
609 | - if(!is_string($currency)) { |
|
609 | + if (!is_string($currency)) { |
|
610 | 610 | throw new \InvalidArgumentException('$currency has to be a string'); |
611 | 611 | } |
612 | 612 | |
613 | 613 | foreach ($this->prices as $price) { |
614 | - if($price->getCurrency()->getIsoCodeAlpha() === $currency) { |
|
614 | + if ($price->getCurrency()->getIsoCodeAlpha() === $currency) { |
|
615 | 615 | return $price; |
616 | 616 | } |
617 | 617 | } |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | $product = $product->getExternalId(); |
669 | 669 | } |
670 | 670 | |
671 | - return $this->children->exists(function ($key, ProductInterface $element) use ($product) { |
|
671 | + return $this->children->exists(function($key, ProductInterface $element) use ($product) { |
|
672 | 672 | return $element->getExternalId() === $product; |
673 | 673 | }); |
674 | 674 | } |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | */ |
682 | 682 | public function getId(): int |
683 | 683 | { |
684 | - return (int)$this->id; |
|
684 | + return (int) $this->id; |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | /** |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | */ |
700 | 700 | public function getExternalId(): int |
701 | 701 | { |
702 | - return (int)$this->externalId; |
|
702 | + return (int) $this->externalId; |
|
703 | 703 | } |
704 | 704 | |
705 | 705 | /** |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | */ |
1096 | 1096 | public function getNumber() |
1097 | 1097 | { |
1098 | - return (string)$this->number; |
|
1098 | + return (string) $this->number; |
|
1099 | 1099 | } |
1100 | 1100 | |
1101 | 1101 | /** |