Skip to content

Commit

Permalink
Dont check for EAN to exist
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielpiriz committed Oct 24, 2023
1 parent eb116b6 commit 5083e0d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
9 changes: 3 additions & 6 deletions src/Model/Product/BaseProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ abstract class BaseProduct implements JsonSerializable
protected $brand;

/**
* @var string
* @var string|null
*/
protected $productId;

Expand Down Expand Up @@ -171,7 +171,7 @@ public function getBrand(): Brand
return $this->brand;
}

public function getProductId(): string
public function getProductId(): ?string
{
return $this->productId;
}
Expand Down Expand Up @@ -313,7 +313,7 @@ public function jsonSerialize(): stdClass
return $serialized;
}

protected static function ValidateArguments(string $sellerSku, string $name, string $description, string $productId): void
protected static function ValidateArguments(string $sellerSku, string $name, string $description): void
{
if (empty($sellerSku)) {
throw new EmptyArgumentException('SellerSku');
Expand All @@ -326,8 +326,5 @@ protected static function ValidateArguments(string $sellerSku, string $name, str
if (empty($description)) {
throw new EmptyArgumentException('Description');
}
if (empty($productId)) {
throw new EmptyArgumentException('ProductId');
}
}
}
2 changes: 1 addition & 1 deletion src/Model/Product/Contract/ProductInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function getDescription(): string;

public function getBrand(): Brand;

public function getProductId(): string;
public function getProductId(): ?string;

public function getTaxClass(): ?string;

Expand Down
2 changes: 1 addition & 1 deletion src/Model/Product/GlobalProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static function fromBasicData(
?Images $images = null,
?string $qcStatus = null
): self {
self::ValidateArguments($sellerSku, $name, $description, $productId);
self::ValidateArguments($sellerSku, $name, $description);

$product = new static();

Expand Down
2 changes: 1 addition & 1 deletion src/Model/Product/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static function fromBasicData(
?Images $images = null,
?array $overrideAttributes = []
): self {
self::ValidateArguments($sellerSku, $name, $description, $productId);
self::ValidateArguments($sellerSku, $name, $description);

if ($price <= 0) {
throw new InvalidDomainException('Price');
Expand Down

0 comments on commit 5083e0d

Please sign in to comment.