Updated LabeledPrice

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

View file

@ -7,15 +7,8 @@
class LabeledPrice implements ObjectTypeInterface class LabeledPrice implements ObjectTypeInterface
{ {
/** private string $label;
* @var string private int $amount;
*/
private $label;
/**
* @var int
*/
private $amount;
/** /**
* Portion label * Portion label
@ -42,9 +35,7 @@
} }
/** /**
* Returns an array representation of the object * @inheritDoc
*
* @return array
*/ */
public function toArray(): array public function toArray(): array
{ {
@ -55,15 +46,16 @@
} }
/** /**
* Constructs the object from an array representation * @inheritDoc
*
* @param array $data
* @return LabeledPrice
*/ */
public static function fromArray(array $data): self public static function fromArray(?array $data): ?LabeledPrice
{ {
$object = new self(); if($data === null)
{
return null;
}
$object = new self();
$object->label = $data['label'] ?? null; $object->label = $data['label'] ?? null;
$object->amount = $data['amount'] ?? null; $object->amount = $data['amount'] ?? null;