mirror of
https://github.com/anikeen-com/id.git
synced 2026-03-16 07:06:13 +00:00
fix some issues
Signed-off-by: Maurice Preuß (envoyr) <hello@envoyr.com>
This commit is contained in:
@@ -4,6 +4,7 @@ namespace Anikeen\Id\Resources;
|
||||
|
||||
use Anikeen\Id\Concerns\HasBillable;
|
||||
use Anikeen\Id\Exceptions\RequestRequiresClientIdException;
|
||||
use Anikeen\Id\Result;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
|
||||
namespace Anikeen\Id\Resources;
|
||||
|
||||
use Anikeen\Id\Exceptions\RequestRequiresClientIdException;
|
||||
use Anikeen\Id\Result;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use JsonSerializable;
|
||||
|
||||
abstract class BaseCollection implements JsonSerializable
|
||||
@@ -19,7 +17,7 @@ abstract class BaseCollection implements JsonSerializable
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return (array) $this->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;
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user