File: /home/imensosw/www/mpl.imenso.co/app/TourManager/Warning/Warning.php
<?php
namespace App\TourManager\Warning;
use Carbon\Carbon;
class Warning
{
public $date;
public $location;
public $message;
public $fatal = 0;
public function __construct($date = '', $location = '', $message = '')
{
$this->setDate($date);
$this->setLocation($location);
$this->setMessage($message);
return $this;
}
public function hasDate()
{
if (is_object($this->date) && get_class($this->date) == Carbon::class) {
return true;
}
return false;
}
public function getDay($format = 'j')
{
if ($this->hasDate()) {
return $this->getDateWithFormat($format);
}
return '';
}
public function getMonth($format = 'M')
{
if ($this->hasDate()) {
return $this->getDateWithFormat($format);
}
return '';
}
public function getDateWithFormat($format = 'jS M Y')
{
if ($this->hasDate()) {
return $this->date->format($format);
}
return '';
}
public function setDate($date)
{
$this->date = $date;
return $this;
}
public function setLocation($location)
{
$this->location = $location;
return $this;
}
public function getMessage()
{
return $this->message;
}
public function setMessage($message)
{
$this->message = $message;
return $this;
}
public function setAsFatal()
{
$this->fatal = 1;
}
public function isFatal()
{
return $this->fatal;
}
}