<?php
namespace App\Api\BrcBackend\DTO;
use App\Api\BrcBackend\Enum\ProfileType;
final class RandomProfile implements ProfileInterface
{
private int $id;
private string $name;
private string $slug;
private City $city;
private \DateTime $createdAt;
private \DateTime $issueDate;
private \DateTime $validityDate;
private ProfileType $type;
/**
* @throws \Exception
*/
public function __construct(array $profile)
{
$this->id = $profile['id'];
$this->name = $profile['name'];
$this->slug = $profile['slug'];
$this->city = new City($profile['city']['id'], $profile['city']['name']);
$this->createdAt = new \DateTime($profile['createdAt']);
$this->issueDate = new \DateTime($profile['issueDate']);
$this->validityDate = new \DateTime($profile['validityDate']);
$this->type = ProfileType::get($profile['type']);
}
public function getId(): int
{
return $this->id;
}
public function getName(): string
{
return $this->name;
}
public function getSlug(): string
{
return $this->slug;
}
public function getCity(): City
{
return $this->city;
}
public function getCreatedAt(): \DateTime
{
return $this->createdAt;
}
public function getIssueDate(): \DateTime
{
return $this->issueDate;
}
public function getValidityDate(): \DateTime
{
return $this->validityDate;
}
public function getType(): ProfileType
{
return $this->type;
}
}