src/Carbon/CarbonPeriod.php
public function setDateInterval($interval)
    {
        if (!$interval = CarbonInterval::make($interval)) {
            throw new InvalidArgumentException('Invalid interval.');
        }

        if ($interval->spec() === 'PT0S') {
            throw new InvalidArgumentException('Empty interval is not accepted.');
        }

        $this->dateInterval = $interval;

        $this->isDefaultInterval = false;

        $this->handleChangedParameters();

        return $this;
    }
public function setDateInterval($interval)
    {
        if (!$interval = CarbonInterval::make($interval)) {
            throw new InvalidArgumentException('Invalid interval.');
        }

        if ($interval->spec() === 'PT0S') {
            throw new InvalidArgumentException('Empty interval is not accepted.');
        }

        $this->dateInterval = $interval;

        $this->isDefaultInterval = false;

        $this->handleChangedParameters();

        return $this;
    }
public function setDateInterval ( $ interval ) { if ( ! $ interval = CarbonInterval :: make ( $ interval ) ) { throw new InvalidArgumentException ( 'Invalid interval.' ) ; } if ( $ interval -> spec ( ) === 'PT0S' ) { throw new InvalidArgumentException ( 'Empty interval is not accepted.' ) ; } $ this -> dateInterval = $ interval ; $ this -> isDefaultInterval = false ; $ this -> handleChangedParameters ( ) ; return $ this ; }
Change the period date interval.

@param DateInterval|string $interval

@throws \InvalidArgumentException

@return $this
Change the period date interval .