Skip to content

Commit

Permalink
Make location data nullable for error responses
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaalyn committed Mar 13, 2022
1 parent 16f7808 commit ea1f472
Showing 1 changed file with 48 additions and 48 deletions.
96 changes: 48 additions & 48 deletions src/Dto/LocationDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,32 @@ class LocationDto
protected $status;

/**
* @var string
* @var string|null
*/
protected $latitude;

/**
* @var string
* @var string|null
*/
protected $longitude;

/**
* @var string
* @var string|null
*/
protected $timezone;

/**
* @var string
* @var string|null
*/
protected $region;

/**
* @var string
* @var string|null
*/
protected $country;

/**
* @var string
* @var string|null
*/
protected $city;

Expand All @@ -47,22 +47,22 @@ class LocationDto

/**
* @param string $status
* @param string $latitude
* @param string $longitude
* @param string $timezone
* @param string $region
* @param string $country
* @param string $city
* @param string|null $latitude
* @param string|null $longitude
* @param string|null $timezone
* @param string|null $region
* @param string|null $country
* @param string|null $city
* @param string $message
*/
public function __construct(
string $status,
string $latitude,
string $longitude,
string $timezone,
string $region,
string $country,
string $city,
?string $latitude,
?string $longitude,
?string $timezone,
?string $region,
?string $country,
?string $city,
string $message
) {
$this->setStatus($status)
Expand Down Expand Up @@ -96,119 +96,119 @@ public function setStatus(string $status): LocationDto
}

/**
* @return string
* @return string|null
*/
public function getLatitude(): string
public function getLatitude(): ?string
{
return $this->latitude;
}

/**
* @param string $latitude
* @param string|null $latitude
*
* @return LocationDto
*/
public function setLatitude(string $latitude): LocationDto
public function setLatitude(?string $latitude): LocationDto
{
$this->latitude = $latitude;

return $this;
}

/**
* @return string
* @return string|null
*/
public function getLongitude(): string
public function getLongitude(): ?string
{
return $this->longitude;
}

/**
* @param string $longitude
* @param string|null $longitude
*
* @return LocationDto
*/
public function setLongitude(string $longitude): LocationDto
public function setLongitude(?string $longitude): LocationDto
{
$this->longitude = $longitude;

return $this;
}

/**
* @return string
* @return string|null
*/
public function getTimezone(): string
public function getTimezone(): ?string
{
return $this->timezone;
}

/**
* @param string $timezone
* @param string|null $timezone
*
* @return LocationDto
*/
public function setTimezone(string $timezone): LocationDto
public function setTimezone(?string $timezone): LocationDto
{
$this->timezone = $timezone;

return $this;
}

/**
* @return string
* @return string|null
*/
public function getRegion(): string
public function getRegion(): ?string
{
return $this->region;
}

/**
* @param string $region
* @param string|null $region
*
* @return LocationDto
*/
public function setRegion(string $region): LocationDto
public function setRegion(?string $region): LocationDto
{
$this->region = $region;

return $this;
}

/**
* @return string
* @return string|null
*/
public function getCountry(): string
public function getCountry(): ?string
{
return $this->country;
}

/**
* @param string $country
* @param string|null $country
*
* @return LocationDto
*/
public function setCountry(string $country): LocationDto
public function setCountry(?string $country): LocationDto
{
$this->country = $country;

return $this;
}

/**
* @return string
* @return string|null
*/
public function getCity(): string
public function getCity(): ?string
{
return $this->city;
}

/**
* @param string $city
* @param string|null $city
*
* @return LocationDto
*/
public function setCity(string $city): LocationDto
public function setCity(?string $city): LocationDto
{
$this->city = $city;

Expand Down Expand Up @@ -244,12 +244,12 @@ public static function fromArray(array $locationData): self
{
return new self(
$locationData['status'],
(string)$locationData['lat'],
(string)$locationData['lon'],
$locationData['timezone'],
$locationData['region'],
$locationData['country'],
$locationData['city'],
(string)$locationData['lat'] ?? null,
(string)$locationData['lon'] ?? null,
$locationData['timezone'] ?? null,
$locationData['region'] ?? null,
$locationData['country'] ?? null,
$locationData['city'] ?? null,
$locationData['message']
);
}
Expand Down

0 comments on commit ea1f472

Please sign in to comment.