1
0
mirror of https://github.com/danog/MadelineProto.git synced 2025-01-11 09:48:17 +01:00
MadelineProto/src/EventHandler/Update.php

26 lines
636 B
PHP
Raw Normal View History

2023-06-28 15:50:38 +02:00
<?php declare(strict_types=1);
namespace danog\MadelineProto\EventHandler;
use danog\MadelineProto\Ipc\IpcCapable;
2023-07-10 10:12:46 +02:00
use JsonSerializable;
2023-07-27 13:20:30 +02:00
use ReflectionClass;
use ReflectionProperty;
2023-06-28 15:50:38 +02:00
/**
* Represents a generic update.
*/
2023-07-10 10:12:46 +02:00
abstract class Update extends IpcCapable implements JsonSerializable
2023-06-28 15:50:38 +02:00
{
2023-07-14 20:15:04 +02:00
/** @internal */
2023-07-27 13:20:30 +02:00
final public function jsonSerialize(): mixed
2023-07-10 10:12:46 +02:00
{
2023-07-27 13:20:30 +02:00
$res = ['_' => static::class];
$refl = new ReflectionClass($this);
foreach ($refl->getProperties(ReflectionProperty::IS_PUBLIC) as $prop) {
$res[$prop->getName()] = $prop->getValue($this);
}
return $res;
2023-07-10 10:12:46 +02:00
}
2023-06-28 15:50:38 +02:00
}