Updated UserProfilePhotos

This commit is contained in:
netkas 2024-10-06 15:54:27 -04:00
parent f2dbe173b5
commit 2afeada5d5

View file

@ -7,15 +7,8 @@
class UserProfilePhotos implements ObjectTypeInterface class UserProfilePhotos implements ObjectTypeInterface
{ {
/** private int $total_count;
* @var int private array $photos;
*/
private $total_count;
/**
* @var PhotoSize[][]
*/
private $photos;
/** /**
* Total number of profile pictures the target user has * Total number of profile pictures the target user has
@ -38,9 +31,7 @@
} }
/** /**
* Returns an array representation of the object * @inheritDoc
*
* @return array
*/ */
public function toArray(): array public function toArray(): array
{ {
@ -57,13 +48,15 @@
} }
/** /**
* Constructs object from an array representation * @inheritDoc
*
* @param array $data
* @return UserProfilePhotos
*/ */
public static function fromArray(array $data): UserProfilePhotos public static function fromArray(?array $data): ?UserProfilePhotos
{ {
if($data === null)
{
return null;
}
$object = new self(); $object = new self();
$object->total_count = $data['total_count']; $object->total_count = $data['total_count'];
$object->photos = array_map(function (array $photo) $object->photos = array_map(function (array $photo)
@ -73,6 +66,7 @@
return PhotoSize::fromArray($photoSize); return PhotoSize::fromArray($photoSize);
}, $photo); }, $photo);
}, $data['photos']); }, $data['photos']);
return $object; return $object;
} }
} }