ExpressiveDate::getDateAttribute PHP Method

getDateAttribute() protected method

Get a date attribute.
protected getDateAttribute ( string $attribute ) : mixed
$attribute string
return mixed
    protected function getDateAttribute($attribute)
    {
        switch ($attribute) {
            case 'Day':
                return $this->format('d');
                break;
            case 'Month':
                return $this->format('m');
                break;
            case 'Year':
                return $this->format('Y');
                break;
            case 'Hour':
                return $this->format('G');
                break;
            case 'Minute':
                return $this->format('i');
                break;
            case 'Second':
                return $this->format('s');
                break;
            case 'DayOfWeek':
                return $this->format('l');
                break;
            case 'DayOfWeekAsNumeric':
                return (7 + $this->format('w') - $this->getWeekStartDay()) % 7;
                break;
            case 'DaysInMonth':
                return $this->format('t');
                break;
            case 'DayOfYear':
                return $this->format('z');
                break;
            case 'DaySuffix':
                return $this->format('S');
                break;
            case 'GmtDifference':
                return $this->format('O');
                break;
            case 'SecondsSinceEpoch':
                return $this->format('U');
                break;
            case 'TimezoneName':
                return $this->getTimezone()->getName();
                break;
        }
        throw new InvalidArgumentException('The date attribute [' . $attribute . '] could not be found.');
    }