Recurr\Rule::setWeekStart PHP Méthode

setWeekStart() public méthode

Valid values are MO, TU, WE, TH, FR, SA and SU. This is significant when a WEEKLY RRULE has an interval greater than 1, and a BYDAY rule part is specified. This is also significant when in a YEARLY RRULE when a BYWEEKNO rule is specified. The default value is MO.
public setWeekStart ( string $weekStart )
$weekStart string The day on which the workweek starts.
    public function setWeekStart($weekStart)
    {
        $weekStart = strtoupper($weekStart);
        if (!in_array($weekStart, array('MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU'))) {
            throw new InvalidArgument('Week Start must be one of MO, TU, WE, TH, FR, SA, SU');
        }
        $this->weekStart = $weekStart;
        $this->weekStartDefined = true;
        return $this;
    }

Usage Example

Exemple #1
0
 /**
  * @expectedException \Recurr\Exception\InvalidArgument
  */
 public function testBadWeekStart()
 {
     $this->rule->setWeekStart('monday');
 }