Created
July 6, 2020 13:48
-
-
Save hgraca/1bca105e73def2d126d622974dd1a500 to your computer and use it in GitHub Desktop.
A DTO example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
final class CreatePostalCodeCommand | |
{ | |
private string $postalCode; | |
private string $locality; | |
private float $latitude; | |
private float $longitude; | |
private string $administrativeArea; | |
public function __construct( | |
string $postalCode, | |
string $locality, | |
float $latitude, | |
float $longitude, | |
string $administrativeArea | |
) { | |
$this->postalCode = $postalCode; | |
$this->locality = $locality; | |
$this->latitude = $latitude; | |
$this->longitude = $longitude; | |
$this->administrativeArea = $administrativeArea; | |
} | |
public function getPostalCode(): string | |
{ | |
return $this->postalCode; | |
} | |
public function getLocality(): string | |
{ | |
return $this->locality; | |
} | |
public function getLatitude(): float | |
{ | |
return $this->latitude; | |
} | |
public function getLongitude(): float | |
{ | |
return $this->longitude; | |
} | |
public function getAdministrativeArea(): string | |
{ | |
return $this->administrativeArea; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment