mirror of
https://github.com/anikeen-com/id.git
synced 2026-03-14 22:26:14 +00:00
@@ -6,12 +6,34 @@ use stdClass;
|
||||
|
||||
trait MagicProperties
|
||||
{
|
||||
protected function setMagicProperties(stdClass $data): void
|
||||
protected function setMagicProperties(stdClass|array $data): void
|
||||
{
|
||||
foreach ($data as $key => $value) {
|
||||
foreach ((object)$data as $key => $value) {
|
||||
if (!property_exists($this, $key)) {
|
||||
$this->{$key} = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic getter: return null for undefined properties
|
||||
*
|
||||
* @param string $name
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function __get(string $name)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic isset: return false for undefined properties
|
||||
*
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function __isset(string $name): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,9 @@ trait ManagesInvoices
|
||||
* @throws RequestRequiresClientIdException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function invoices(): Invoices
|
||||
public function invoices(array $parameters = []): Invoices
|
||||
{
|
||||
return (new Invoices($this->request('GET', 'v1/invoices')))
|
||||
return (new Invoices($this->request('GET', 'v1/invoices', [], $parameters)))
|
||||
->setBillable($this);
|
||||
}
|
||||
}
|
||||
@@ -18,9 +18,9 @@ trait ManagesOrders
|
||||
* @throws RequestRequiresClientIdException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function orders(): Orders
|
||||
public function orders(array $parameters = []): Orders
|
||||
{
|
||||
return (new Orders($this->request('GET', 'v1/orders')))
|
||||
return (new Orders($this->request('GET', 'v1/orders', [], $parameters)))
|
||||
->setBillable($this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user