Skip to content

Commit

Permalink
fix: update PHPDoc return type for getOrderType and simplify orderDat…
Browse files Browse the repository at this point in the history
…eTime method

Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed Feb 22, 2025
1 parent 23c4332 commit ccee81a
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/Classes/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public function checkOrderType($code = null)
}

/**
* @return \Igniter\Cart\Classes\AbstractOrderType
* @return ?\Igniter\Cart\Classes\AbstractOrderType
*/
public function getOrderType($code = null)
{
Expand Down Expand Up @@ -367,20 +367,15 @@ public function checkOrderTime($timestamp = null, $orderTypeCode = null)
return $orderType->getSchedule()->isOpenAt($timestamp);
}

/**
* @return \Carbon\Carbon
*/
public function orderDateTime()
public function orderDateTime(): Carbon
{
$dateTime = $this->getSession($this->orderType().'-timeslot.dateTime');
if ($this->orderTimeIsAsap()) {
$dateTime = $this->asapScheduleTimeslot();
}

if (!$dateTime || now()->isAfter($dateTime)) {
$dateTime = $this->hasAsapSchedule()
? $this->asapScheduleTimeslot()
: $this->firstScheduleTimeslot();
$dateTime = $this->hasAsapSchedule() ? $this->asapScheduleTimeslot() : $this->firstScheduleTimeslot();
}

return make_carbon($dateTime);
Expand Down

0 comments on commit ccee81a

Please sign in to comment.