public function __construct($designation, $code = 0, Exception $previous = null) { switch ($code) { case 1: //Sold Out $this->message = sprintf($this->message, $designation, 'sold out.'); break; case 2: //not for sale $this->message = sprintf($this->message, $designation, 'not for sale.'); break; } parent::__construct($this->message, $code, $previous); }
public function __construct($designation, Carbon $startTime, Carbon $endTime = null, $code = 0, Exception $previous = null) { switch ($code) { case 1: $startString = $startTime->isToday() ? 'today starting at ' . $startTime->format('g:ia') : $startTime->format('M jS g:ia'); $endString = $endTime->isToday() ? $endTime->format('g:ia') : $endTime->format('M jS g:ia'); $this->message = sprintf($this->messageBetween, $designation, $startString, $endString); break; case 2: $startString = $startTime->isToday() ? $startTime->format('g:ia') : $startTime->format('M jS g:ia'); $this->message = sprintf($this->messageAfter, $designation, $startString); break; case 3: $endString = $endTime->isToday() ? $endTime->format('g:ia') : $endTime->format('M jS g:ia'); $this->message = sprintf($this->messageBefore, $designation, $endString); break; } parent::__construct($this->message, $code, $previous); }
public function __construct($designation, $purchaseQuantity, $code = 1, Exception $previous = null) { $this->message = sprintf($this->message, $this->extremities[$code], $designation, $purchaseQuantity); parent::__construct($this->message, $code, $previous); }
public function __construct($designation, $code = 0, Exception $previous = null) { $this->message = sprintf($this->message, $designation); parent::__construct($this->message, $code, $previous); }