FormClasses/src/Information.php
2024-05-21 17:06:42 +03:00

78 lines
1.8 KiB
PHP

<?php
/**
* @property string $surname
* @property string $name
* @property string $patronymic
* @property string $dateOfBirth
* @property string $gender
* @property string $countryCode
* @property string $phoneNumber
* @property string $email
*/
class Information
{
public string $surname;
public string $name;
public string $patronymic;
public string $dateOfBirth;
public string $gender;
public string $countryCode;
public string $phoneNumber;
public string $email;
//public $gender;
public function __construct()
{
}
/**
* @param array $dataArray
* @return void
*/
public function load(array $dataArray): void
{
if ($dataArray) {
$this->surname = $dataArray['surname'] ?? '';
$this->name = $dataArray['name'] ?? '';
$this->patronymic = $dataArray['patronymic'] ?? '';
$this->dateOfBirth = $dataArray['dateOfBirth'] ?? '';
$this->gender = $dataArray['gender'] ?? '';
$this->countryCode = $dataArray['countryCode'] ?? '';
$this->phoneNumber = $dataArray['phoneNumber'] ?? '';
$this->email = $dataArray['email'] ?? '';
}
}
/**
* @param string $key
* @return string|null
*/
public function getByKey(string $key): ?string
{
if (isset($this->{$key})) {
return $this->{$key};
}
return null;
}
/**
* @return string
*/
public function toString(): string
{
return $this->surname . ';' . $this->name . ';' . $this->patronymic . ';' . $this->dateOfBirth . ';' .
$this->gender . ';' . $this->countryCode . ';' . $this->phoneNumber . ';' . $this->email . "\n";
}
public function search()
{
}
}