Files
2023-07-14 12:55:06 +08:00

79 lines
1.5 KiB
PHP

<?php
namespace App\Classes\Modules\Addresses\DataTransferObjects;
use App\Classes\General\Interfaces\DataTransferObject;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
class DistrictObject implements DataTransferObject
{
/** @var string */
private $name;
/** @var int */
private $countryId;
/** @var int */
private $stateId;
/** @var string */
private $postCodes;
/** @var int|null */
private $status;
/**
* DistrictObject constructor.
* @param int $countryId
* @param int $stateId
* @param string $postCodes
*/
public function __construct(string $name, int $countryId, int $stateId, string $postCodes, ?int $status = ApprovalStatus::APPROVED)
{
$this->name = $name;
$this->countryId = $countryId;
$this->stateId = $stateId;
$this->postCodes = $postCodes;
$this->status = $status;
}
/**
* @return string
*/
public function getName(): string
{
return $this->name;
}
/**
* @return int
*/
public function getCountryId(): int
{
return $this->countryId;
}
/**
* @return int
*/
public function getStateId(): int
{
return $this->stateId;
}
/**
* @return array
*/
public function getPostCodes(): array
{
return array_map('trim', explode(',', $this->postCodes));
}
/**
* @return int
*/
public function getStatus(): int
{
return $this->status;
}
}