| Server IP : 95.46.96.79 / Your IP : 216.73.216.84 Web Server : Apache/2.4.41 (Ubuntu) System : Linux zaimer.uz 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : akslabs_uz_usr ( 1001) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/sugurtatrip__usr95/data/www/sugurtatrip.uz/api/src/Models/Apex/ |
Upload File : |
<?php
class ApexModel {
private $start_date;
private $end_date;
private $country;
private $program_id;
private $purpose_id;
private $group_id;
private $person_info;
public function __construct($start_date, $end_date, $country, $program_id, $purpose_id, $group_id, $person_info) {
$this->setStartDate($start_date);
$this->setEndDate($end_date);
$this->setCountry($country);
$this->setProgramId($program_id);
$this->setPurposeId($purpose_id);
$this->setGroupId($group_id);
$this->setPersonInfo($person_info);
}
public function setStartDate($start_date) {
if ($this->validateDate($start_date)) {
$this->start_date = $start_date;
} else {
throw new Exception("Invalid start_date format");
}
}
public function setEndDate($end_date) {
if ($this->validateDate($end_date)) {
$this->end_date = $end_date;
} else {
throw new Exception("Invalid end_date format");
}
}
public function setCountry($country) {
if (is_array($country)) {
$this->country = $country;
} else {
throw new Exception("Country must be an array");
}
}
public function setProgramId($program_id) {
if (is_int($program_id)) {
$this->program_id = $program_id;
} else {
throw new Exception("Invalid program_id format");
}
}
public function setPurposeId($purpose_id) {
if (is_int($purpose_id)) {
$this->purpose_id = $purpose_id;
} else {
throw new Exception("Invalid purpose_id format");
}
}
public function setGroupId($group_id) {
if (is_int($group_id)) {
$this->group_id = $group_id;
} else {
throw new Exception("Invalid group_id format");
}
}
public function setPersonInfo($person_info) {
if (is_array($person_info)) {
foreach ($person_info as $person) {
if (!isset($person['birthday']) || !$this->validateDate($person['birthday'])) {
throw new Exception("Invalid person_info data");
}
}
$this->person_info = $person_info;
} else {
throw new Exception("Invalid person_info format");
}
}
private function validateDate($date) {
$d = DateTime::createFromFormat('d.m.Y', $date);
return $d && $d->format('d.m.Y') === $date;
}
public function getStartDate() {
return $this->start_date;
}
public function getEndDate() {
return $this->end_date;
}
public function getCountry() {
return $this->country;
}
public function getProgramId() {
return $this->program_id;
}
public function getPurposeId() {
return $this->purpose_id;
}
public function getGroupId() {
return $this->group_id;
}
public function getPersonInfo() {
return $this->person_info;
}
}