mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
260 lines
4.6 KiB
PHP
260 lines
4.6 KiB
PHP
<?php
|
|
/**
|
|
* Orange Management
|
|
*
|
|
* PHP Version 7.0
|
|
*
|
|
* @category TBD
|
|
* @package TBD
|
|
* @author OMS Development Team <dev@oms.com>
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
* @copyright 2013 Dennis Eichhorn
|
|
* @license OMS License 1.0
|
|
* @version 1.0.0
|
|
* @link http://orange-management.com
|
|
*/
|
|
namespace phpOMS\Datatypes;
|
|
|
|
use phpOMS\Contract\JsonableInterface;
|
|
|
|
/**
|
|
* Location class.
|
|
*
|
|
* @category Framework
|
|
* @package phpOMS\Datatypes
|
|
* @author OMS Development Team <dev@oms.com>
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
* @license OMS License 1.0
|
|
* @link http://orange-management.com
|
|
* @since 1.0.0
|
|
*/
|
|
class Location implements JsonableInterface
|
|
{
|
|
|
|
/**
|
|
* Zip or postal.
|
|
*
|
|
* @var \string
|
|
* @since 1.0.0
|
|
*/
|
|
private $postal = null;
|
|
|
|
/**
|
|
* Name of city.
|
|
*
|
|
* @var \string
|
|
* @since 1.0.0
|
|
*/
|
|
private $city = null;
|
|
|
|
/**
|
|
* Name of the country.
|
|
*
|
|
* @var \string
|
|
* @since 1.0.0
|
|
*/
|
|
private $country = null;
|
|
|
|
/**
|
|
* Street & district.
|
|
*
|
|
* @var \string
|
|
* @since 1.0.0
|
|
*/
|
|
private $address = null;
|
|
|
|
/**
|
|
* State.
|
|
*
|
|
* @var \string
|
|
* @since 1.0.0
|
|
*/
|
|
private $state = null;
|
|
|
|
/**
|
|
* Geo coordinates.
|
|
*
|
|
* @var \float[]
|
|
* @since 1.0.0
|
|
*/
|
|
private $geo = null;
|
|
|
|
/**
|
|
* Constructor.
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public function __construct()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @return \string
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public function getPostal() : \string
|
|
{
|
|
return $this->postal;
|
|
}
|
|
|
|
/**
|
|
* @param \string $postal
|
|
*
|
|
* @return void
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public function setPostal(\string $postal)
|
|
{
|
|
$this->postal = $postal;
|
|
}
|
|
|
|
/**
|
|
* @return \string
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public function getCity() : \string
|
|
{
|
|
return $this->city;
|
|
}
|
|
|
|
/**
|
|
* @param \string $city
|
|
*
|
|
* @return void
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public function setCity(\string $city)
|
|
{
|
|
$this->city = $city;
|
|
}
|
|
|
|
/**
|
|
* @return \string
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public function getCountry() : \string
|
|
{
|
|
return $this->country;
|
|
}
|
|
|
|
/**
|
|
* @param \string $country
|
|
*
|
|
* @return void
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public function setCountry(\string $country)
|
|
{
|
|
$this->country = $country;
|
|
}
|
|
|
|
/**
|
|
* @return \string
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public function getAddress() : \string
|
|
{
|
|
return $this->address;
|
|
}
|
|
|
|
/**
|
|
* @param \string $address
|
|
*
|
|
* @return void
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public function setAddress(\string $address)
|
|
{
|
|
$this->address = $address;
|
|
}
|
|
|
|
/**
|
|
* @return \string
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public function getState() : \string
|
|
{
|
|
return $this->state;
|
|
}
|
|
|
|
/**
|
|
* @param \string $state
|
|
*
|
|
* @return void
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public function setState(\string $state)
|
|
{
|
|
$this->state = $state;
|
|
}
|
|
|
|
/**
|
|
* @return \float[]
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public function getGeo() : array
|
|
{
|
|
return $this->geo;
|
|
}
|
|
|
|
/**
|
|
* @param \float[] $geo
|
|
*
|
|
* @return void
|
|
*
|
|
* @since 1.0.0
|
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
*/
|
|
public function setGeo(array $geo)
|
|
{
|
|
$this->geo = $geo;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function toArray() : array
|
|
{
|
|
return [
|
|
'postal' => $this->postal,
|
|
'city' => $this->city,
|
|
'country' => $this->country,
|
|
'address' => $this->address,
|
|
'state' => $this->state,
|
|
'geo' => $this->geo,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function toJson(\int $option = 0) : \string
|
|
{
|
|
return json_encode($this->toArray());
|
|
}
|
|
|
|
}
|