Horde_Date_Repeater::next PHP Method

next() public method

returns the next occurance of this repeatable.
public next ( $pointer = 'future' )
    public function next($pointer = 'future')
    {
        if (is_null($this->now)) {
            throw new Horde_Date_Repeater_Exception('Start point must be set before calling next()');
        }
        if (!in_array($pointer, array('future', 'none', 'past'))) {
            throw new Horde_Date_Repeater_Exception("First argument 'pointer' must be one of 'past', 'future', 'none'");
        }
    }

Usage Example

Esempio n. 1
0
 public function next($pointer = 'future')
 {
     parent::next($pointer);
     if (!$this->currentFortnightStart) {
         switch ($pointer) {
             case 'future':
                 $sundayRepeater = new Horde_Date_Repeater_DayName('sunday');
                 $sundayRepeater->now = $this->now;
                 $nextSundaySpan = $sundayRepeater->next('future');
                 $this->currentFortnightStart = $nextSundaySpan->begin;
                 break;
             case 'past':
                 $sundayRepeater = new Horde_Date_Repeater_DayName('sunday');
                 $sundayRepeater->now = clone $this->now;
                 $sundayRepeater->now->day++;
                 $sundayRepeater->next('past');
                 $sundayRepeater->next('past');
                 $lastSundaySpan = $sundayRepeater->next('past');
                 $this->currentFortnightStart = $lastSundaySpan->begin;
                 break;
         }
     } else {
         $direction = $pointer == 'future' ? 1 : -1;
         $this->currentFortnightStart->add($direction * self::FORTNIGHT_SECONDS);
     }
     return new Horde_Date_Span($this->currentFortnightStart, $this->currentFortnightStart->add(self::FORTNIGHT_SECONDS));
 }
All Usage Examples Of Horde_Date_Repeater::next