WIP - Order steps & remaining APIs

This commit is contained in:
Fairuz
2021-07-23 12:41:06 +08:00
parent 67e104d7e7
commit d7131dd5f8
22 changed files with 239 additions and 276 deletions
@@ -3,94 +3,55 @@
namespace App\Classes\Modules\Schedules\DataTransferObjects;
use App\Classes\General\Interfaces\DataTransferObject;
use Carbon\Carbon;
class ScheduleObject implements DataTransferObject
{
/** @var string */
private $streetOne;
/** @var Carbonn date */
private $etd;
/** @var string|null */
private $streetTwo;
/** @var Carbon date */
private $eta;
/** @var int */
private $countryId;
/** @var int */
private $stateId;
/** @var int */
private $districtId;
/** @var int */
private $postCode;
private $transport_id;
/**
* ScheduleObject constructor.
* @param string $streetOne
* @param null|string $streetTwo
* @param int $countryId
* @param int $stateId
* @param int $districtId
* @param int $postCode
* ScheduleObject constructor
* @param int $etd
* @param int $eta
* @param int $transport_id
*/
public function __construct(string $streetOne, ?string $streetTwo, int $countryId, int $stateId, int $districtId, int $postCode)
public function __construct(string $etd, string $eta, int $transport_id)
{
$this->streetOne = $streetOne;
$this->streetTwo = $streetTwo;
$this->countryId = $countryId;
$this->stateId = $stateId;
$this->districtId = $districtId;
$this->postCode = $postCode;
$this->etd = $etd;
$this->eta = $eta;
$this->transport_id = $transport_id;
}
/**
* @return string
*/
public function getStreetOne(): string
public function getETD(): Carbon
{
return $this->streetOne;
return $this->completed_date ? Carbon::parse($this->etd);
}
/**
* @return null|string
* @return string
*/
public function getStreetTwo(): ?string
public function getETA(): Carbon
{
return $this->streetTwo;
return $this->completed_date ? Carbon::parse($this->eta);
}
/**
* @return int
*/
public function getCountryId(): int
public function getTransportId(): int
{
return $this->countryId;
return $this->transport_id;
}
/**
* @return int
*/
public function getStateId(): int
{
return $this->stateId;
}
/**
* @return int
*/
public function getDistrictId(): int
{
return $this->districtId;
}
/**
* @return int
*/
public function getPostCode(): int
{
return $this->postCode;
}
}