mirror of
https://github.com/BushlanovDev/max-bot-api-client-php.git
synced 2026-08-24 00:06:49 +00:00
Added editBotInfo & editChat & getVideoAttachmentDetails
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace BushlanovDev\MaxMessengerBot\Models;
|
||||
|
||||
/**
|
||||
* An abstract base for PATCH request models. It uses a variadic constructor
|
||||
* to capture named arguments, tracking which fields were explicitly set.
|
||||
*/
|
||||
abstract readonly class AbstractPatchModel extends AbstractModel
|
||||
{
|
||||
/**
|
||||
* @var array<int|string, mixed>
|
||||
*/
|
||||
protected array $patchData;
|
||||
|
||||
/**
|
||||
* Captures all passed named arguments into an associative array.
|
||||
*
|
||||
* @param mixed ...$params
|
||||
*/
|
||||
public function __construct(...$params)
|
||||
{
|
||||
$this->patchData = $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
final public function toArray(): array
|
||||
{
|
||||
$result = [];
|
||||
foreach ($this->patchData as $key => $value) {
|
||||
$jsonKey = $this->toSnakeCase((string)$key);
|
||||
$result[$jsonKey] = $this->convertValue($value);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user