1
0
mirror of https://github.com/danog/MadelineProto.git synced 2025-01-22 13:53:04 +01:00

Add GeoPoint class

This commit is contained in:
َAhJ 2023-08-08 19:43:01 +03:30
parent 7399c19f99
commit 366c87afa5

View File

@ -0,0 +1,33 @@
<?php declare(strict_types=1);
namespace danog\MadelineProto\EventHandler\Media;
use JsonSerializable;
final class GeoPoint implements JsonSerializable
{
/** @var int Longitude */
public readonly int $long;
/** @var int Latitude */
public readonly int $lat;
/** @var int Access hash */
public readonly int $accessHash;
/** @var int The estimated horizontal accuracy of the location, in meters; as defined by the sender. */
public readonly ?int $accuracyRadius;
public function __construct(array $rawGeoPoint)
{
$this->long = $rawGeoPoint['long'];
$this->lat = $rawGeoPoint['lat'];
$this->accessHash = $rawGeoPoint['accessHash'];
$this->accuracyRadius = $rawGeoPoint['accuracyRadius'] ?? null;
}
/** @internal */
public function jsonSerialize(): mixed
{
$v = \get_object_vars($this);
$v['_'] = static::class;
return $v;
}
}