| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <?php
- declare (strict_types=1);
- namespace App\ApiResources\Utils;
- use ApiPlatform\Metadata\ApiResource;
- use ApiPlatform\Metadata\Link;
- use ApiPlatform\Metadata\GetCollection;
- use ApiPlatform\Metadata\Get;
- use ApiPlatform\Metadata\ApiProperty;
- use App\ApiResources\ApiResourcesInterface;
- use App\State\Provider\Utils\GpsCoordinateSearchingProvider;
- /**
- * Classe resource qui contient les champs de recherche des coordonnées GPS d'une adresse
- */
- #[ApiResource(
- provider: GpsCoordinateSearchingProvider::class,
- operations: [
- new Get(uriTemplate: '/gps-coordinate-reverse/{latitude}/{longitude}'),
- new GetCollection(uriTemplate: '/gps-coordinate-searching')
- ]
- )]
- class GpsCoordinate implements ApiResourcesInterface
- {
- #[ApiProperty(identifier: true)]
- private float $latitude;
- #[ApiProperty(identifier: true)]
- private float $longitude;
- private ?string $streetAddress = null;
- private ?string $streetAddressSecond = null;
- private ?string $streetAddressThird = null;
- private ?string $cp = null;
- private ?string $city = null;
- private ?string $country = null;
- public function __construct()
- {
- $this->setLatitude(0.0);
- $this->setLongitude(0.0);
- }
- public function setLatitude(?float $latitude): self
- {
- $this->latitude = $latitude;
- return $this;
- }
- public function getLatitude(): ?float
- {
- return $this->latitude;
- }
- public function getLongitude(): ?float
- {
- return $this->longitude;
- }
- public function setLongitude(?float $longitude): self
- {
- $this->longitude = $longitude;
- return $this;
- }
- public function getStreetAddress(): ?string
- {
- return $this->streetAddress;
- }
- public function setStreetAddress(?string $streetAddress): self
- {
- $this->streetAddress = $streetAddress;
- return $this;
- }
- public function getStreetAddressSecond(): ?string
- {
- return $this->streetAddressSecond;
- }
- public function setStreetAddressSecond(?string $streetAddressSecond): self
- {
- $this->streetAddressSecond = $streetAddressSecond;
- return $this;
- }
- public function getStreetAddressThird(): ?string
- {
- return $this->streetAddressThird;
- }
- public function setStreetAddressThird(?string $streetAddressThird): self
- {
- $this->streetAddressThird = $streetAddressThird;
- return $this;
- }
- public function getCp(): ?string
- {
- return $this->cp;
- }
- public function setCp(?string $cp): self
- {
- $this->cp = $cp;
- return $this;
- }
- public function getCity(): ?string
- {
- return $this->city;
- }
- public function setCity(?string $city): self
- {
- $this->city = $city;
- return $this;
- }
- public function getCountry(): ?string
- {
- return $this->country;
- }
- public function setCountry(?string $country): self
- {
- $this->country = $country;
- return $this;
- }
- }
|