Moved Objects
This commit is contained in:
parent
848a2a78e3
commit
6c67e97a4b
167 changed files with 368 additions and 373 deletions
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Objects\BackgroundFill;
|
||||
|
||||
use TgBotLib\Enums\Types\BackgroundFillType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\BackgroundFill;
|
||||
|
||||
class BackgroundFillFreeformGradient extends BackgroundFill implements ObjectTypeInterface
|
||||
{
|
||||
/**
|
||||
* @var int[]
|
||||
*/
|
||||
private array $colors;
|
||||
|
||||
/**
|
||||
* A list of the 3 or 4 base colors that are used to generate the freeform gradient in the RGB24 format
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getColors(): array
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'type' => $this->type->value,
|
||||
'colors' => $this->colors
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function fromArray(array $data): BackgroundFill
|
||||
{
|
||||
$object = new self();
|
||||
|
||||
$object->type = BackgroundFillType::FREEFORM_GRADIENT;
|
||||
$object->colors = $data['colors'];
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Objects\BackgroundFill;
|
||||
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\BackgroundFill;
|
||||
|
||||
class BackgroundFillGradient extends BackgroundFill implements ObjectTypeInterface
|
||||
{
|
||||
private int $top_color;
|
||||
private int $bottom_color;
|
||||
private int $rotation_angle;
|
||||
|
||||
/**
|
||||
* Top color of the gradient in the RGB24 format
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTopColor(): int
|
||||
{
|
||||
return $this->top_color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bottom color of the gradient in the RGB24 format
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getBottomColor(): int
|
||||
{
|
||||
return $this->bottom_color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clockwise rotation angle of the background fill in degrees; 0-359
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRotationAngle(): int
|
||||
{
|
||||
return $this->rotation_angle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'type' => $this->type->value,
|
||||
'top_color' => $this->top_color,
|
||||
'bottom_color' => $this->bottom_color,
|
||||
'rotation_angle' => $this->rotation_angle
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function fromArray(array $data): BackgroundFillGradient
|
||||
{
|
||||
$object = new self();
|
||||
$object->type = $data['type'] ?? null;
|
||||
$object->top_color = $data['top_color'] ?? 0;
|
||||
$object->bottom_color = $data['bottom_color'] ?? 0;
|
||||
$object->rotation_angle = $data['rotation_angle'] ?? 0;
|
||||
return $object;
|
||||
}
|
||||
}
|
46
src/TgBotLib/Objects/BackgroundFill/BackgroundFillSolid.php
Normal file
46
src/TgBotLib/Objects/BackgroundFill/BackgroundFillSolid.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Objects\BackgroundFill;
|
||||
|
||||
use TgBotLib\Enums\Types\BackgroundFillType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\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