1
0

downgrade to kirby v3

This commit is contained in:
Philip Wagner
2024-09-01 10:47:15 +02:00
parent a4b2aece7b
commit af86acb7a1
1085 changed files with 54743 additions and 65042 deletions

View File

@@ -14,8 +14,19 @@ namespace Kirby\Image;
*/
class Location
{
protected float|null $lat = null;
protected float|null $lng = null;
/**
* latitude
*
* @var float|null
*/
protected $lat;
/**
* longitude
*
* @var float|null
*/
protected $lng;
/**
* Constructor
@@ -24,43 +35,44 @@ class Location
*/
public function __construct(array $exif)
{
if (
isset($exif['GPSLatitude']) === true &&
if (isset($exif['GPSLatitude']) === true &&
isset($exif['GPSLatitudeRef']) === true &&
isset($exif['GPSLongitude']) === true &&
isset($exif['GPSLongitudeRef']) === true
) {
$this->lat = $this->gps(
$exif['GPSLatitude'],
$exif['GPSLatitudeRef']
);
$this->lng = $this->gps(
$exif['GPSLongitude'],
$exif['GPSLongitudeRef']
);
$this->lat = $this->gps($exif['GPSLatitude'], $exif['GPSLatitudeRef']);
$this->lng = $this->gps($exif['GPSLongitude'], $exif['GPSLongitudeRef']);
}
}
/**
* Returns the latitude
*
* @return float|null
*/
public function lat(): float|null
public function lat()
{
return $this->lat;
}
/**
* Returns the longitude
*
* @return float|null
*/
public function lng(): float|null
public function lng()
{
return $this->lng;
}
/**
* Converts the gps coordinates
*
* @param string|array $coord
* @param string $hemi
* @return float
*/
protected function gps(array $coord, string $hemi): float
protected function gps($coord, string $hemi): float
{
$degrees = count($coord) > 0 ? $this->num($coord[0]) : 0;
$minutes = count($coord) > 1 ? $this->num($coord[1]) : 0;
@@ -74,6 +86,9 @@ class Location
/**
* Converts coordinates to floats
*
* @param string $part
* @return float
*/
protected function num(string $part): float
{
@@ -88,6 +103,8 @@ class Location
/**
* Converts the object into a nicely readable array
*
* @return array
*/
public function toArray(): array
{
@@ -99,15 +116,18 @@ class Location
/**
* Echos the entire location as lat, lng
*
* @return string
*/
public function __toString(): string
{
return trim($this->lat() . ', ' . $this->lng(), ',');
return trim(trim($this->lat() . ', ' . $this->lng(), ','));
}
/**
* Improved `var_dump` output
* @codeCoverageIgnore
*
* @return array
*/
public function __debugInfo(): array
{