MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
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;
    }
}