From 2afeada5d5bfb906fcacd9e11fd354cb5b34b015 Mon Sep 17 00:00:00 2001 From: netkas Date: Sun, 6 Oct 2024 15:54:27 -0400 Subject: [PATCH] Updated UserProfilePhotos --- src/TgBotLib/Objects/UserProfilePhotos.php | 28 +++++++++------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/TgBotLib/Objects/UserProfilePhotos.php b/src/TgBotLib/Objects/UserProfilePhotos.php index d53485a..8d8816a 100644 --- a/src/TgBotLib/Objects/UserProfilePhotos.php +++ b/src/TgBotLib/Objects/UserProfilePhotos.php @@ -7,15 +7,8 @@ class UserProfilePhotos implements ObjectTypeInterface { - /** - * @var int - */ - private $total_count; - - /** - * @var PhotoSize[][] - */ - private $photos; + private int $total_count; + private array $photos; /** * Total number of profile pictures the target user has @@ -38,9 +31,7 @@ } /** - * Returns an array representation of the object - * - * @return array + * @inheritDoc */ public function toArray(): array { @@ -57,13 +48,15 @@ } /** - * Constructs object from an array representation - * - * @param array $data - * @return UserProfilePhotos + * @inheritDoc */ - public static function fromArray(array $data): UserProfilePhotos + public static function fromArray(?array $data): ?UserProfilePhotos { + if($data === null) + { + return null; + } + $object = new self(); $object->total_count = $data['total_count']; $object->photos = array_map(function (array $photo) @@ -73,6 +66,7 @@ return PhotoSize::fromArray($photoSize); }, $photo); }, $data['photos']); + return $object; } } \ No newline at end of file