mirror of
https://github.com/danog/MadelineProto.git
synced 2025-01-22 16:51:16 +01:00
Add GeoPoint class
This commit is contained in:
parent
7399c19f99
commit
366c87afa5
33
src/EventHandler/Media/GeoPoint.php
Normal file
33
src/EventHandler/Media/GeoPoint.php
Normal 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;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user