src/App/Model/ContentReportData.php line 8

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace App\Model;
  3. use App\Entity\Country;
  4. use RuntimeException;
  5. class ContentReportData
  6. {
  7.     /**
  8.      * @var array<mixed>
  9.      */
  10.     private array $data = [];
  11.     private ?string $stageName null;
  12.     private ?string $firstName null;
  13.     private ?string $lastName null;
  14.     private ?string $companyName null;
  15.     private ?string $commercialRegistrationNumber null;
  16.     private ?string $email null;
  17.     private ?string $phone null;
  18.     private ?string $address null;
  19.     private ?string $addressAdditional null;
  20.     private ?string $city null;
  21.     private ?string $zipCode null;
  22.     private ?string $country null;
  23.     /**
  24.      * @param array<mixed> $data
  25.      */
  26.     public function __construct(array $data = [])
  27.     {
  28.         $this->data $data;
  29.     }
  30.     /**
  31.      * @return mixed[]
  32.      */
  33.     public function getData(): array
  34.     {
  35.         return $this->data;
  36.     }
  37.     /**
  38.      * @param array<mixed> $data
  39.      */
  40.     public function setData(array $data): void
  41.     {
  42.         $this->data $data;
  43.     }
  44.     public function getFirstName(): ?string
  45.     {
  46.         if (null === $this->firstName && isset($this->data['firstName']) && '' !== $this->data['firstName']) {
  47.             if (!is_string($this->data['firstName'])) {
  48.                 throw new RuntimeException('Invalid data on key "firstName"');
  49.             }
  50.             $this->firstName $this->data['firstName'];
  51.         }
  52.         return $this->firstName;
  53.     }
  54.     public function setFirstName(string $firstName): void
  55.     {
  56.         $this->data['firstName'] = $firstName;
  57.         $this->firstName $firstName;
  58.     }
  59.     public function getLastName(): ?string
  60.     {
  61.         if (null === $this->lastName && isset($this->data['lastName']) && '' !== $this->data['lastName']) {
  62.             if (!is_string($this->data['lastName'])) {
  63.                 throw new RuntimeException('Invalid data on key "lastName"');
  64.             }
  65.             $this->lastName $this->data['lastName'];
  66.         }
  67.         return $this->lastName;
  68.     }
  69.     public function setLastName(string $lastName): void
  70.     {
  71.         $this->data['lastName'] = $lastName;
  72.         $this->lastName $lastName;
  73.     }
  74.     public function getStageName(): ?string
  75.     {
  76.         if (null === $this->stageName && isset($this->data['stageName']) && '' !== $this->data['stageName']) {
  77.             if (!is_string($this->data['stageName'])) {
  78.                 throw new RuntimeException('Invalid data on key "stageName"');
  79.             }
  80.             $this->stageName $this->data['stageName'];
  81.         }
  82.         return $this->stageName;
  83.     }
  84.     public function setStageName(?string $stageName): void
  85.     {
  86.         $this->data['stageName'] = $stageName;
  87.         $this->stageName $stageName;
  88.     }
  89.     public function getCompanyName(): ?string
  90.     {
  91.         if (null === $this->companyName && isset($this->data['companyName']) && '' !== $this->data['companyName']) {
  92.             if (!is_string($this->data['companyName'])) {
  93.                 throw new RuntimeException('Invalid data on key "companyName"');
  94.             }
  95.             $this->companyName $this->data['companyName'];
  96.         }
  97.         return $this->companyName;
  98.     }
  99.     public function setCompanyName(string $companyName): void
  100.     {
  101.         $this->data['companyName'] = $companyName;
  102.         $this->companyName $companyName;
  103.     }
  104.     public function getCommercialRegistrationNumber(): ?string
  105.     {
  106.         if (null === $this->commercialRegistrationNumber && isset($this->data['commercialRegistrationNumber']) && '' !== $this->data['commercialRegistrationNumber']) {
  107.             if (!is_string($this->data['commercialRegistrationNumber'])) {
  108.                 throw new RuntimeException('Invalid data on key "commercialRegistrationNumber"');
  109.             }
  110.             $this->commercialRegistrationNumber $this->data['commercialRegistrationNumber'];
  111.         }
  112.         return $this->commercialRegistrationNumber;
  113.     }
  114.     public function setCommercialRegistrationNumber(?string $commercialRegistrationNumber): void
  115.     {
  116.         $this->data['commercialRegistrationNumber'] = $commercialRegistrationNumber;
  117.         $this->commercialRegistrationNumber $commercialRegistrationNumber;
  118.     }
  119.     public function getEmail(): ?string
  120.     {
  121.         if (null === $this->email && isset($this->data['email']) && '' !== $this->data['email']) {
  122.             if (!is_string($this->data['email'])) {
  123.                 throw new RuntimeException('Invalid data on key "email"');
  124.             }
  125.             $this->email $this->data['email'];
  126.         }
  127.         return $this->email;
  128.     }
  129.     public function setEmail(string $email): void
  130.     {
  131.         $this->data['email'] = $email;
  132.         $this->email $email;
  133.     }
  134.     public function getPhone(): ?string
  135.     {
  136.         if (null === $this->phone && isset($this->data['phone']) && '' !== $this->data['phone']) {
  137.             if (!is_string($this->data['phone'])) {
  138.                 throw new RuntimeException('Invalid data on key "phone"');
  139.             }
  140.             $this->phone $this->data['phone'];
  141.         }
  142.         return $this->phone;
  143.     }
  144.     public function setPhone(?string $phone): void
  145.     {
  146.         $this->data['phone'] = $phone;
  147.         $this->phone $phone;
  148.     }
  149.     public function getAddress(): ?string
  150.     {
  151.         if (null === $this->address && isset($this->data['address']) && '' !== $this->data['address']) {
  152.             if (!is_string($this->data['address'])) {
  153.                 throw new RuntimeException('Invalid data on key "address"');
  154.             }
  155.             $this->address $this->data['address'];
  156.         }
  157.         return $this->address;
  158.     }
  159.     public function setAddress(string $address): void
  160.     {
  161.         $this->data['address'] = $address;
  162.         $this->address $address;
  163.     }
  164.     public function getZipCode(): ?string
  165.     {
  166.         if (null === $this->zipCode && isset($this->data['zipCode']) && '' !== $this->data['zipCode']) {
  167.             if (!is_string($this->data['zipCode'])) {
  168.                 throw new RuntimeException('Invalid data on key "zipCode"');
  169.             }
  170.             $this->zipCode $this->data['zipCode'];
  171.         }
  172.         return $this->zipCode;
  173.     }
  174.     public function setZipCode(string $zipCode): void
  175.     {
  176.         $this->data['zipCode'] = $zipCode;
  177.         $this->zipCode $zipCode;
  178.     }
  179.     public function getCity(): ?string
  180.     {
  181.         if (null === $this->city && isset($this->data['city']) && '' !== $this->data['city']) {
  182.             if (!is_string($this->data['city'])) {
  183.                 throw new RuntimeException('Invalid data on key "city"');
  184.             }
  185.             $this->city $this->data['city'];
  186.         }
  187.         return $this->city;
  188.     }
  189.     public function setCity(string $city): void
  190.     {
  191.         $this->data['city'] = $city;
  192.         $this->city $city;
  193.     }
  194.     public function getAddressAdditional(): ?string
  195.     {
  196.         if (null === $this->addressAdditional && isset($this->data['addressAdditional']) && '' !== $this->data['addressAdditional']) {
  197.             if (!is_string($this->data['addressAdditional'])) {
  198.                 throw new RuntimeException('Invalid data on key "addressAdditional"');
  199.             }
  200.             $this->addressAdditional $this->data['addressAdditional'];
  201.         }
  202.         return $this->addressAdditional;
  203.     }
  204.     public function setAddressAdditional(string $addressAdditional): void
  205.     {
  206.         $this->data['addressAdditional'] = $addressAdditional;
  207.         $this->addressAdditional $addressAdditional;
  208.     }
  209.     public function getCountry(): ?string
  210.     {
  211.         if (null === $this->country && isset($this->data['country']) && '' !== $this->data['country']) {
  212.             if (!is_string($this->data['country'])) {
  213.                 throw new RuntimeException('Invalid data on key "country"');
  214.             }
  215.             $this->country $this->data['country'];
  216.         }
  217.         return $this->country;
  218.     }
  219.     public function setCountry(Country $country): void
  220.     {
  221.         $countryName $country->getName();
  222.         $this->data['country'] = $countryName;
  223.         $this->country $countryName;
  224.     }
  225. }