Updated LabeledPrice
This commit is contained in:
parent
a84b20e0fb
commit
196d4a063c
1 changed files with 10 additions and 18 deletions
|
@ -7,15 +7,8 @@
|
|||
|
||||
class LabeledPrice implements ObjectTypeInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $label;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $amount;
|
||||
private string $label;
|
||||
private int $amount;
|
||||
|
||||
/**
|
||||
* Portion label
|
||||
|
@ -42,9 +35,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
* @return array
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
|
@ -55,15 +46,16 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs the object from an array representation
|
||||
*
|
||||
* @param array $data
|
||||
* @return LabeledPrice
|
||||
* @inheritDoc
|
||||
*/
|
||||
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->amount = $data['amount'] ?? null;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue