Recurr\Rule::setFreq PHP Method

setFreq() public method

May be one of: - Frequency::SECONDLY to specify repeating events based on an interval of a second or more. - Frequency::MINUTELY to specify repeating events based on an interval of a minute or more. - Frequency::HOURLY to specify repeating events based on an interval of an hour or more. - Frequency::DAILY to specify repeating events based on an interval of a day or more. - Frequency::WEEKLY to specify repeating events based on an interval of a week or more. - Frequency::MONTHLY to specify repeating events based on an interval of a month or more. - Frequency::YEAR to specify repeating events based on an interval of a year or more.
public setFreq ( string $freq )
$freq string Frequency of recurrence.
    public function setFreq($freq)
    {
        if (is_string($freq)) {
            if (!array_key_exists($freq, self::$freqs)) {
                throw new InvalidArgument('Frequency must comply with RFC 2445.');
            } else {
                $freq = self::$freqs[$freq];
            }
        }
        if (is_int($freq) && ($freq < 0 || $freq > 6)) {
            throw new InvalidArgument('Frequency integer must be between 0 and 6 Use the class constants.');
        }
        $this->freq = $freq;
        return $this;
    }

Usage Example

示例#1
0
 public function testGetStringWithUTC()
 {
     $this->rule->setFreq('DAILY');
     $this->rule->setInterval(1);
     $this->rule->setUntil(new \DateTime('2015-07-10 04:00:00', new \DateTimeZone('America/New_York')));
     $this->assertNotEquals('FREQ=DAILY;UNTIL=20150710T040000Z;INTERVAL=1', $this->rule->getString());
     $this->assertEquals('FREQ=DAILY;UNTIL=20150710T080000Z;INTERVAL=1', $this->rule->getString(Rule::TZ_FIXED));
 }
All Usage Examples Of Recurr\Rule::setFreq