From 196d4a063c1fd706d455090f1d29e59e5bfc8eb1 Mon Sep 17 00:00:00 2001 From: netkas Date: Fri, 4 Oct 2024 15:14:02 -0400 Subject: [PATCH] Updated LabeledPrice --- .../Objects/Payments/LabeledPrice.php | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/TgBotLib/Objects/Payments/LabeledPrice.php b/src/TgBotLib/Objects/Payments/LabeledPrice.php index 697b66c..3492965 100644 --- a/src/TgBotLib/Objects/Payments/LabeledPrice.php +++ b/src/TgBotLib/Objects/Payments/LabeledPrice.php @@ -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;