Move files and adjust namespaces

This commit is contained in:
Brabli
2022-07-21 15:42:05 +01:00
parent d2e324f263
commit a8c0b55fcd
2 changed files with 2 additions and 2 deletions

View File

@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace Pcm\GeocodeBundle\Entity\Interface;
interface MappableInterface
{
public function getLatitude(): ?float;
public function getLongitude(): ?float;
public function setLatitude(float $lat): self;
public function setLongitude(float $lon): self;
public function isGeocoded(): bool;
}

View File

@@ -0,0 +1,53 @@
<?php
declare(strict_types=1);
namespace Pcm\GeocodeBundle\Entity\Trait;
/**
* Allows an entity to be mapped via latitude and longitude coordinates
*
* Use MappableInterface
*
* @package Pcm\GeocodeBundle
*/
trait MappableTrait
{
private ?float $latitude = null;
private ?float $longitude = null;
public function getLatitude(): ?float
{
return $this->latitude;
}
public function getLongitude(): ?float
{
return $this->longitude;
}
public function setLatitude(float $lat): self
{
$this->latitude = $lat;
return $this;
}
public function setLongitude(float $lon): self
{
$this->longitude = $lon;
return $this;
}
/**
* Returns true if both latitude and longitude have been set
*
* @return bool
*/
public function isGeocoded(): bool
{
return null !== $this->getLatitude() && null !== $this->getLongitude();
}
}