ExpressiveDate::setDateAttribute PHP Method

setDateAttribute() protected method

Set a date attribute.
protected setDateAttribute ( string $attribute, $value ) : mixed
$attribute string
return mixed
    protected function setDateAttribute($attribute, $value)
    {
        switch ($attribute) {
            case 'Day':
                return $this->setDate($this->getYear(), $this->getMonth(), $value);
                break;
            case 'Month':
                return $this->setDate($this->getYear(), $value, $this->getDay());
                break;
            case 'Year':
                return $this->setDate($value, $this->getMonth(), $this->getDay());
                break;
            case 'Hour':
                return $this->setTime($value, $this->getMinute(), $this->getSecond());
                break;
            case 'Minute':
                return $this->setTime($this->getHour(), $value, $this->getSecond());
                break;
            case 'Second':
                return $this->setTime($this->getHour(), $this->getMinute(), $value);
                break;
        }
        throw new InvalidArgumentException('The date attribute [' . $attribute . '] could not be set.');
    }