initital commit
This commit is contained in:
22
src/DTO/Factory/GEOPointFactory.php
Normal file
22
src/DTO/Factory/GEOPointFactory.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTO\Factory;
|
||||
|
||||
use App\DTO\GEOPoint;
|
||||
|
||||
class GEOPointFactory
|
||||
{
|
||||
public function createFromString(string|float|int $lat, string|float|int $lon): ?GEOPoint
|
||||
{
|
||||
if (is_numeric($lat) && is_numeric($lon)) {
|
||||
$lat = floatval($lat);
|
||||
$lon = floatval($lon);
|
||||
|
||||
return new GEOPoint($lat, $lon);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user