Add the passed interval to the current instance.

@param string|DateInterval $unit
@param int                 $value

@return static
488321
public function add($unit, $value = 1)
    {
        if (is_numeric($unit)) {
            $_unit = $value;
            $value = $unit;
            $unit = $_unit;
            unset($_unit);
        }

        if (is_string($unit) && !preg_match('/^\s*\d/', $unit)) {
            $unit = "$value $unit";
            $value = 1;
        }

        $interval = static::make($unit);

        if (!$interval) {
            throw new InvalidArgumentException('This type of data cannot be added/subtracted.');
        }

        if ($value !== 1) {
            $interval->times($value);
        }
        $sign = ($this->invert === 1) !== ($interval->invert === 1) ? -1 : 1;
        $this->years += $interval->y * $sign;
        $this->months += $interval->m * $sign;
        $this->dayz += ($interval->days === false ? $interval->d : $interval->days) * $sign;
        $this->hours += $interval->h * $sign;
        $this->minutes += $interval->i * $sign;
        $this->seconds += $interval->s * $sign;
        $this->microseconds += $interval->microseconds * $sign;

        $this->solveNegativeInterval();

        return $this;
    }
313548
public function dateTo(\DateTime $value)
    {
        $this->add(new Criterium(self::CRITERIUM_END_DATE, $value));

        return $this;
    }
1043198
public function dateIs(\DateTime $value)
    {
        $this->add(new Criterium(self::CRITERIUM_DATE_IS, $value));

        return $this;
    }
29797
public function defaultValue($value): AbstractColumn
    {
        //Forcing driver specific values
        if ($value === self::DATETIME_NOW) {
            $value = static::DATETIME_NOW;
        }

        $this->defaultValue = $value;

        return $this;
    }
1028234
protected function Add( $value )
	{
	    switch ( $value->GetValueCode() )
	    {
	        case DayTimeDurationProxyFactory::Code:
	        	/**
	        	 * @var DayTimeDurationProxy $value
	        	 */
	        	// Clone the DateValue contained in the proxy or the original is changed
	        	$clone = new TimeValue( clone $this->_value->Value, ! $this->_value->IsLocal );
	        	return new TimeProxy( TimeValue::AddDayTimeDuration( $clone, $value->getValue() ) );
	        	// return new TimeProxy( TimeValue::Add( $this->_value, /* DayTimeDurationValue */ $value->getValue() ) );

	        default:
	            throw XPath2Exception::withErrorCodeAndParams( "XPTY0004", Resources::BinaryOperatorNotDefined,
					array(
						"op:add",
						SequenceType::WithTypeCodeAndCardinality( SequenceType::GetXmlTypeCodeFromObject( $this->_value), XmlTypeCardinality::One ),
						SequenceType::WithTypeCodeAndCardinality( SequenceType::GetXmlTypeCodeFromObject( $value->getValue() ), XmlTypeCardinality::One )
					)
				);
	    }
	}
1337774
public function setAddition($value)
    {
        if (!isset($this->data->amount->subtotals)) {
            $this->data->amount->subtotals = new stdClass();
        }
        $this->data->amount->subtotals->addition = (float) $value;

        return $this;
    }
1229153
public function setExpiresIn(DateInterval $interval)
    {
        $now = new DateTimeImmutable();
        $expire = $now->add($interval);
        $this->setExpiresInSeconds($expire->getTimestamp() - $now->getTimestamp());
        return $this;
    }
209737
public function setTimezone($value)
    {
        /** @var static $date */
        $date = parent::setTimezone(static::safeCreateDateTimeZone($value));
        // https://bugs.php.net/bug.php?id=72338
        // just workaround on this bug
        $date->getTimestamp();

        return $date;
    }
504651
public function addWeekdays($value)
    {
        $direction = $value > 0 ? 1 : -1;
        $value = abs($value);

        while ($value > 0) {
            $this->addDays($direction);

            while ($this->isWeekend()) {
                $this->addDays($direction);
            }

            $value--;
        }

        return $this;
    }
449176
protected function Add( $value )
	{
		switch ( $value->GetValueCode() )
		{
			case YearMonthDurationProxyFactory::Code:
				/**
				 * @var YearMonthDurationProxy $value
				 */
				// return new YearMonthDurationProxy( new YearMonthDurationValue( $this->_value->HighPartValue + (/* YearMonthDurationValue */ $value->getValue() )->HighPartValue));
				$clone = new YearMonthDurationValue( $this->_value->Value );
				$clone->Add( /* YearMonthDurationValue */ $value->getValue() );
				return new YearMonthDurationProxy( $clone );

			case DateTimeProxyFactory::Code:
				/**
				 * @var DateTimeProxy $value
				 */
				return new DateTimeProxy( DateTimeValue::AddYearMonthDuration( $value->getValue(), $this->_value ) );
				// return new DateTimeProxy( DateTimeValue::Add( /* DateTimeValue */ $value->getValue(), $this->_value ) );

			case DateProxyFactory::Code:
				/**
				 * @var DateProxy $value
				 */
				return new DateProxy( DateValue::AddYearMonthDuration( $value->getValue(), $this->_value ) );
				// return new DateProxy( DateValue::Add( /*DateValue */ $value->getValue(), $this->_value ) );

			default:
				throw XPath2Exception::withErrorCodeAndParams( "XPTY0004", Resources::BinaryOperatorNotDefined,
					array(
						"op:add",
						SequenceType::WithTypeCodeAndCardinality(SequenceType::GetXmlTypeCodeFromObject( $this->_value ), XmlTypeCardinality::One ),
						SequenceType::WithTypeCodeAndCardinality(SequenceType::GetXmlTypeCodeFromObject( $value->getValue() ), XmlTypeCardinality::One )
					)
				);
		}
	}
354180
public function addWeekdays($value)
    {
        // Fix for weekday bug https://bugs.php.net/bug.php?id=54909
        $t = $this->toTimeString();
        $this->modify((int) $value.' weekday');

        return $this->setTimeFromTimeString($t);
    }
135727
public function setHour( int $value = null ) : Time
   {

      if ( \is_null( $value ) )
      {
         $this->properties[ 'hour' ] = static::CurrentHour();
         return $this;
      }

      $intValue = \intval( $value );

      if ( $intValue < 0 )
      {
         $this->properties[ 'hour' ] = 0;
      }
      else if ( $intValue > 23 )
      {
         $this->properties[ 'hour' ] = $intValue % 24;
      }
      else
      {
         $this->properties[ 'hour' ] = $intValue;
      }

      return $this;

   }
1280199
public static function instance(DateInterval $di)
    {
        if (self::wasCreatedFromDiff($di)) {
            throw new InvalidArgumentException('Can not instance a Interval object created from DateTime::diff().');
        }

        $instance = new static($di->y, $di->m, 0, $di->d, $di->h, $di->i, $di->s);
        $instance->invert = $di->invert;
        $instance->days = $di->days;

        return $instance;
    }
515165
public function add(DateInterval $interval)
	{
		$years   = $this->y + $interval->y;
		$months  = $this->m + $interval->m;
		$days    = $this->d + $interval->d;
		$hours   = $this->h + $interval->h;
		$minutes = $this->i + $interval->i;
		$seconds = $this->s + $interval->s;

		$spec = sprintf('P%sY%sM%sDT%sH%sM%sS', $years, $months, $days, $hours, $minutes, $seconds);

		return new DateInterval($spec);
	}
1227191
public function add($interval) : self
    {
        $instance = clone $this;
        
        $instance->date->add(self::resolveDateInterval($interval));
        
        return $instance;
    }
391396
public function add($value): SetInterface
    {
        $this->resolver->value(function ($value): void {
            $this->items->add($value);
        }, $value);

        return $this;
    }
125843
public function setInitial($value)
    {
        if ($value instanceof DateTime) {
            $value = new DateTimeWrapper($value->format('c'));
        }

        $this->initial = $value;
        return $this;
    }