addRRule() public method

Add a RRule (or another RSet)
public addRRule ( mixed $rrule )
$rrule mixed an instance of RRuleInterface or something that can be transformed into a RRule (string or array)
示例#1
0
 public function getRSet()
 {
     $rset = new RSet();
     $rset->addRRule($this->getRRule());
     foreach ($this->getExdates() as $exdate) {
         $rset->addExDate($exdate);
     }
     if ($this->getRRule()->isFinite()) {
         return $rset;
     } else {
         return null;
     }
 }
示例#2
0
 public function testGetter()
 {
     $rset = new RSet();
     $rset->addRRule(array('FREQ' => 'YEARLY', 'COUNT' => 2, 'BYDAY' => 'TU', 'DTSTART' => date_create('1997-09-02 09:00')));
     $rset->addRRule(new RRule(array('FREQ' => 'YEARLY', 'COUNT' => 1, 'BYDAY' => 'TH', 'DTSTART' => date_create('1997-09-02 09:00'))));
     $rset->addDate(date_create('1997-09-04 09:00'));
     $rset->addDate(date_create('1997-09-05 09:00'));
     $rset->addDate(date_create('1997-09-06 09:00'));
     $rset->addExRule(array('FREQ' => 'YEARLY', 'COUNT' => 3, 'BYDAY' => 'TH', 'DTSTART' => date_create('1997-09-02 09:00')));
     $this->assertInternalType('array', $rset->getRRules());
     $this->assertCount(2, $rset->getRRules());
     $this->assertInternalType('array', $rset->getExRules());
     $this->assertCount(1, $rset->getExRules());
     $this->assertInternalType('array', $rset->getDates());
     $this->assertCount(3, $rset->getDates());
     $this->assertInternalType('array', $rset->getExDates());
     $this->assertCount(0, $rset->getExDates());
 }