Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Update ShopModel trait to use ShopId interface for value object #643

Merged
merged 3 commits into from
Dec 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/ShopifyApp/Contracts/Objects/Values/ShopId.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Osiset\ShopifyApp\Contracts\Objects\Values;

use Funeralzone\ValueObjects\ValueObject;

/**
* Shop ID's value object.
*/
interface ShopId extends ValueObject
{
}
6 changes: 3 additions & 3 deletions src/ShopifyApp/Contracts/ShopModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Osiset\ShopifyApp\Contracts\ApiHelper as IApiHelper;
use Osiset\ShopifyApp\Contracts\Objects\Values\AccessToken as AccessTokenValue;
use Osiset\ShopifyApp\Contracts\Objects\Values\ShopDomain as ShopDomainValue;
use Osiset\ShopifyApp\Objects\Values\ShopId;
use Osiset\ShopifyApp\Contracts\Objects\Values\ShopId as ShopIdValue;

/**
* Reprecents the shop model.
Expand All @@ -19,9 +19,9 @@ interface ShopModel extends Authenticatable
/**
* Get shop ID as a value object.
*
* @return ShopId
* @return ShopIdValue
*/
public function getId(): ShopId;
public function getId(): ShopIdValue;

/**
* Get shop domain as a value object.
Expand Down
4 changes: 2 additions & 2 deletions src/ShopifyApp/Objects/Values/ShopId.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
namespace Osiset\ShopifyApp\Objects\Values;

use Funeralzone\ValueObjects\Scalars\IntegerTrait;
use Funeralzone\ValueObjects\ValueObject;
use Osiset\ShopifyApp\Contracts\Objects\Values\ShopId as ShopIdValue;

/**
* Value object for shop's ID.
*/
final class ShopId implements ValueObject
final class ShopId implements ShopIdValue
{
use IntegerTrait;
}
3 changes: 2 additions & 1 deletion src/ShopifyApp/Traits/ShopModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Osiset\ShopifyApp\Contracts\ApiHelper as IApiHelper;
use Osiset\ShopifyApp\Contracts\Objects\Values\AccessToken as AccessTokenValue;
use Osiset\ShopifyApp\Contracts\Objects\Values\ShopDomain as ShopDomainValue;
use Osiset\ShopifyApp\Contracts\Objects\Values\ShopId as ShopIdValue;
use Osiset\ShopifyApp\Objects\Values\AccessToken;
use Osiset\ShopifyApp\Objects\Values\ShopDomain;
use Osiset\ShopifyApp\Objects\Values\ShopId;
Expand Down Expand Up @@ -47,7 +48,7 @@ protected static function bootShopModel(): void
/**
* {@inheritdoc}
*/
public function getId(): ShopId
public function getId(): ShopIdValue
{
return ShopId::fromNative($this->id);
}
Expand Down