diff --git a/src/Id/Concerns/HasBillable.php b/src/Id/Concerns/HasBillable.php index 1690854..a0e1e10 100644 --- a/src/Id/Concerns/HasBillable.php +++ b/src/Id/Concerns/HasBillable.php @@ -2,21 +2,18 @@ namespace Anikeen\Id\Concerns; -use Anikeen\Id\Contracts\Billable; -use Illuminate\Database\Eloquent\Model; - trait HasBillable { - protected Billable|Model $billable; + public mixed $billable; - public function setBillable(Billable|Model $billable): self + public function setBillable(mixed $billable): self { $this->billable = $billable; return $this; } - public function getBillable(): Billable|Model + public function getBillable(): mixed { return $this->billable; } diff --git a/src/Id/Concerns/HasParent.php b/src/Id/Concerns/HasParent.php index 844e4d5..afb3730 100644 --- a/src/Id/Concerns/HasParent.php +++ b/src/Id/Concerns/HasParent.php @@ -6,7 +6,7 @@ trait HasParent { protected mixed $parent; - public function setParent($parent): self + public function setParent(mixed $parent): self { $this->parent = $parent; diff --git a/src/Id/Concerns/MagicProperties.php b/src/Id/Concerns/MagicProperties.php index 623e7c9..9e476a6 100644 --- a/src/Id/Concerns/MagicProperties.php +++ b/src/Id/Concerns/MagicProperties.php @@ -9,7 +9,7 @@ trait MagicProperties protected function setMagicProperties(stdClass $data): void { foreach ($data as $key => $value) { - if (property_exists($this, $key)) { + if (!property_exists($this, $key)) { $this->{$key} = $value; } } diff --git a/src/Id/Contracts/Billable.php b/src/Id/Contracts/Billable.php deleted file mode 100644 index 2382d39..0000000 --- a/src/Id/Contracts/Billable.php +++ /dev/null @@ -1,28 +0,0 @@ -result; + return (array)$this->result->data; } /** @@ -32,20 +30,14 @@ abstract class BaseCollection implements JsonSerializable /** * Returns the collection of resources. - * - * @throws RequestRequiresClientIdException - * @throws GuzzleException */ - public function get(): Result + public function paginate(): Result { return $this->result; } /** * Returns the Resource based on the ID. - * - * @throws RequestRequiresClientIdException - * @throws GuzzleException */ abstract public function find(string $id): ?BaseResource; } \ No newline at end of file diff --git a/src/Id/Resources/BaseResource.php b/src/Id/Resources/BaseResource.php index af2ec5c..e28e708 100644 --- a/src/Id/Resources/BaseResource.php +++ b/src/Id/Resources/BaseResource.php @@ -4,9 +4,8 @@ namespace Anikeen\Id\Resources; use Anikeen\Id\Concerns\MagicProperties; use Anikeen\Id\Result; -use JsonSerializable; -abstract class BaseResource implements JsonSerializable +abstract class BaseResource { use MagicProperties; @@ -14,20 +13,4 @@ abstract class BaseResource implements JsonSerializable { $this->setMagicProperties($this->result->data); } - - /** - * Returns the collection of resources as an array. - */ - public function toArray(): array - { - return (array) $this->result->data; - } - - /** - * Returns the collection of resources as a JSON string. - */ - public function jsonSerialize(): array - { - return $this->toArray(); - } } \ No newline at end of file