Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A DTO example
<?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