2023-02-12 14:34:38 -05:00
|
|
|
<?php
|
|
|
|
|
2023-02-14 17:35:16 -05:00
|
|
|
|
2024-10-02 00:18:12 -04:00
|
|
|
namespace TgBotLib\Objects;
|
2023-02-12 14:34:38 -05:00
|
|
|
|
2023-02-12 14:43:30 -05:00
|
|
|
use TgBotLib\Interfaces\ObjectTypeInterface;
|
|
|
|
|
|
|
|
class ChatPhoto implements ObjectTypeInterface
|
2023-02-12 14:34:38 -05:00
|
|
|
{
|
2024-10-04 15:00:51 -04:00
|
|
|
private string $small_file_id;
|
|
|
|
private string $small_file_unique_id;
|
|
|
|
private string $big_file_id;
|
|
|
|
private string $big_file_unique_id;
|
2023-02-12 14:34:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for
|
|
|
|
* as long as the photo is not changed.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getSmallFileId(): string
|
|
|
|
{
|
|
|
|
return $this->small_file_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for
|
|
|
|
* different bots. Can't be used to download or reuse the file.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getSmallFileUniqueId(): string
|
|
|
|
{
|
|
|
|
return $this->small_file_unique_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only
|
|
|
|
* for as long as the photo is not changed.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getBigFileId(): string
|
|
|
|
{
|
|
|
|
return $this->big_file_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for
|
|
|
|
* different bots. Can't be used to download or reuse the file.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getBigFileUniqueId(): string
|
|
|
|
{
|
|
|
|
return $this->big_file_unique_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-10-04 15:00:51 -04:00
|
|
|
* @inheritDoc
|
2023-02-12 14:34:38 -05:00
|
|
|
*/
|
|
|
|
public function toArray(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'small_file_id' => $this->small_file_id,
|
|
|
|
'small_file_unique_id' => $this->small_file_unique_id,
|
|
|
|
'big_file_id' => $this->big_file_id,
|
|
|
|
'big_file_unique_id' => $this->big_file_unique_id,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-10-04 15:00:51 -04:00
|
|
|
* @inheritDoc
|
2023-02-12 14:34:38 -05:00
|
|
|
*/
|
2024-10-04 15:00:51 -04:00
|
|
|
public static function fromArray(?array $data): ?ChatPhoto
|
2023-02-12 14:34:38 -05:00
|
|
|
{
|
2024-10-04 15:00:51 -04:00
|
|
|
if($data === null)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
2023-02-12 14:34:38 -05:00
|
|
|
|
2024-10-04 15:00:51 -04:00
|
|
|
$object = new ChatPhoto();
|
2023-02-14 17:35:16 -05:00
|
|
|
$object->small_file_id = $data['small_file_id'] ?? null;
|
|
|
|
$object->small_file_unique_id = $data['small_file_unique_id'] ?? null;
|
|
|
|
$object->big_file_id = $data['big_file_id'] ?? null;
|
|
|
|
$object->big_file_unique_id = $data['big_file_unique_id'] ?? null;
|
2023-02-12 14:34:38 -05:00
|
|
|
|
|
|
|
return $object;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|