Cake\Chronos\ChronosInterval::add PHP Method

add() public method

Add the passed interval to the current instance
public add ( DateInterval $interval ) : static
$interval DateInterval The interval to add.
return static
    public function add(DateInterval $interval)
    {
        $sign = $interval->invert === 1 ? -1 : 1;
        if (static::wasCreatedFromDiff($interval)) {
            $this->dayz = $this->dayz + $interval->days * $sign;
        } else {
            $this->years = $this->years + $interval->y * $sign;
            $this->months = $this->months + $interval->m * $sign;
            $this->dayz = $this->dayz + $interval->d * $sign;
            $this->hours = $this->hours + $interval->h * $sign;
            $this->minutes = $this->minutes + $interval->i * $sign;
            $this->seconds = $this->seconds + $interval->s * $sign;
        }
        return $this;
    }