src/Api/BrcBackend/DTO/RandomProfile.php line 7

Open in your IDE?
  1. <?php
  2. namespace App\Api\BrcBackend\DTO;
  3. use App\Api\BrcBackend\Enum\ProfileType;
  4. final class RandomProfile implements ProfileInterface
  5. {
  6.     private int $id;
  7.     private string $name;
  8.     private string $slug;
  9.     private City $city;
  10.     private \DateTime $createdAt;
  11.     private \DateTime $issueDate;
  12.     private \DateTime $validityDate;
  13.     private ProfileType $type;
  14.     /**
  15.      * @throws \Exception
  16.      */
  17.     public function __construct(array $profile)
  18.     {
  19.         $this->id $profile['id'];
  20.         $this->name $profile['name'];
  21.         $this->slug $profile['slug'];
  22.         $this->city = new City($profile['city']['id'], $profile['city']['name']);
  23.         $this->createdAt = new \DateTime($profile['createdAt']);
  24.         $this->issueDate = new \DateTime($profile['issueDate']);
  25.         $this->validityDate = new \DateTime($profile['validityDate']);
  26.         $this->type ProfileType::get($profile['type']);
  27.     }
  28.     public function getId(): int
  29.     {
  30.         return $this->id;
  31.     }
  32.     public function getName(): string
  33.     {
  34.         return $this->name;
  35.     }
  36.     public function getSlug(): string
  37.     {
  38.         return $this->slug;
  39.     }
  40.     public function getCity(): City
  41.     {
  42.         return $this->city;
  43.     }
  44.     public function getCreatedAt(): \DateTime
  45.     {
  46.         return $this->createdAt;
  47.     }
  48.     public function getIssueDate(): \DateTime
  49.     {
  50.         return $this->issueDate;
  51.     }
  52.     public function getValidityDate(): \DateTime
  53.     {
  54.         return $this->validityDate;
  55.     }
  56.     public function getType(): ProfileType
  57.     {
  58.         return $this->type;
  59.     }
  60. }