Add BackgroundFill objects
This commit is contained in:
parent
eb15ca3ee9
commit
649004a844
5 changed files with 223 additions and 0 deletions
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Objects\Telegram\BackgroundFill;
|
||||
|
||||
use TgBotLib\Enums\Types\BackgroundFillType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\BackgroundFill;
|
||||
|
||||
class BackgroundFillSolid extends BackgroundFill implements ObjectTypeInterface
|
||||
{
|
||||
private int $color;
|
||||
|
||||
/**
|
||||
* The color of the background fill in the RGB24 format
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getColor(): int
|
||||
{
|
||||
return $this->color;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'type' => $this->type->value,
|
||||
'color' => $this->color
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function fromArray(array $data): BackgroundFill
|
||||
{
|
||||
$object = new self();
|
||||
|
||||
$object->type = BackgroundFillType::SOLID;
|
||||
$object->color = $data['color'];
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue