Updated Invoice

This commit is contained in:
netkas 2024-10-04 15:15:00 -04:00
parent 196d4a063c
commit fdf6e3addc

View file

@ -7,30 +7,11 @@
class Invoice implements ObjectTypeInterface class Invoice implements ObjectTypeInterface
{ {
/** private string $title;
* @var string private string $description;
*/ private string $start_parameter;
private $title; private string $currency;
private int $total_amount;
/**
* @var string
*/
private $description;
/**
* @var string
*/
private $start_parameter;
/**
* @var string
*/
private $currency;
/**
* @var int
*/
private $total_amount;
/** /**
* Product name * Product name
@ -87,9 +68,7 @@
} }
/** /**
* Returns an array representation of the object. * @inheritDoc
*
* @return array
*/ */
public function toArray(): array public function toArray(): array
{ {
@ -103,15 +82,16 @@
} }
/** /**
* Constructs an object from an array representation. * @inheritDoc
*
* @param array $data
* @return Invoice
*/ */
public static function fromArray(array $data): self public static function fromArray(?array $data): ?Invoice
{ {
$object = new self(); if($data === null)
{
return null;
}
$object = new self();
$object->title = $data['title'] ?? null; $object->title = $data['title'] ?? null;
$object->description = $data['description'] ?? null; $object->description = $data['description'] ?? null;
$object->start_parameter = $data['start_parameter'] ?? null; $object->start_parameter = $data['start_parameter'] ?? null;