. * * @author Daniil Gentili * @copyright 2016-2023 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\EventHandler; use danog\MadelineProto\Ipc\IpcCapable; use JsonSerializable; use ReflectionClass; use ReflectionProperty; /** * Represents a generic update. */ abstract class Update extends IpcCapable implements JsonSerializable { /** @internal */ public function jsonSerialize(): mixed { $res = ['_' => static::class]; $refl = new ReflectionClass($this); foreach ($refl->getProperties(ReflectionProperty::IS_PUBLIC) as $prop) { $res[$prop->getName()] = $prop->getValue($this); } return $res; } }