Updated PaidMediaInfo
This commit is contained in:
parent
6f6cd1d936
commit
0a91098f98
1 changed files with 52 additions and 48 deletions
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Objects;
|
||||
namespace TgBotLib\Objects;
|
||||
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
|
||||
class PaidMediaInfo implements ObjectTypeInterface
|
||||
{
|
||||
class PaidMediaInfo implements ObjectTypeInterface
|
||||
{
|
||||
private int $star_count;
|
||||
|
||||
/**
|
||||
|
@ -47,10 +47,14 @@ class PaidMediaInfo implements ObjectTypeInterface
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function fromArray(array $data): PaidMediaInfo
|
||||
public static function fromArray(?array $data): ?PaidMediaInfo
|
||||
{
|
||||
$object = new self();
|
||||
if($data === null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$object = new self();
|
||||
$object->star_count = $data['star_count'];
|
||||
$object->paid_media = array_map(fn(array $paid_media) => PaidMedia::fromArray($paid_media), $data['paid_media']);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue