RRule\RSet::addRRule PHP Method

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)
    public function addRRule($rrule)
    {
        if (is_string($rrule) || is_array($rrule)) {
            $rrule = new RRule($rrule);
        } elseif (!$rrule instanceof RRuleInterface) {
            throw new \InvalidArgumentException('The rule must be a string, an array, or implement RRuleInterface');
        }
        // cloning because I want to iterate it without being disturbed
        $this->rrules[] = clone $rrule;
        $this->clearCache();
        return $this;
    }

Usage Example

Ejemplo n.º 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;
     }
 }
All Usage Examples Of RRule\RSet::addRRule