getInterval() public method

Get the interval that represents how often the recurrence rule repeats.
public getInterval ( ) : integer
return integer
Ejemplo n.º 1
0
 public function testLoadFromString()
 {
     $string = 'FREQ=YEARLY;';
     $string .= 'COUNT=2;';
     $string .= 'INTERVAL=2;';
     $string .= 'BYSECOND=30;';
     $string .= 'BYMINUTE=10;';
     $string .= 'BYHOUR=5,15;';
     $string .= 'BYDAY=SU,WE;';
     $string .= 'BYMONTHDAY=16,22;';
     $string .= 'BYYEARDAY=201,203;';
     $string .= 'BYWEEKNO=29,32;';
     $string .= 'BYMONTH=7,8;';
     $string .= 'BYSETPOS=1,3;';
     $string .= 'WKST=TU;';
     $string .= 'EXDATE=20140607,20140620T010000,20140620T040000Z;';
     $this->rule->loadFromString($string);
     $this->assertEquals(Frequency::YEARLY, $this->rule->getFreq());
     $this->assertEquals(2, $this->rule->getCount());
     $this->assertEquals(2, $this->rule->getInterval());
     $this->assertEquals(array(30), $this->rule->getBySecond());
     $this->assertEquals(array(10), $this->rule->getByMinute());
     $this->assertEquals(array(5, 15), $this->rule->getByHour());
     $this->assertEquals(array('SU', 'WE'), $this->rule->getByDay());
     $this->assertEquals(array(16, 22), $this->rule->getByMonthDay());
     $this->assertEquals(array(201, 203), $this->rule->getByYearDay());
     $this->assertEquals(array(29, 32), $this->rule->getByWeekNumber());
     $this->assertEquals(array(7, 8), $this->rule->getByMonth());
     $this->assertEquals(array(1, 3), $this->rule->getBySetPosition());
     $this->assertEquals('TU', $this->rule->getWeekStart());
     $this->assertEquals(array(new DateExclusion(new \DateTime(20140607), false), new DateExclusion(new \DateTime('20140620T010000'), true), new DateExclusion(new \DateTime('20140620 04:00:00 UTC'), true, true)), $this->rule->getExDates());
 }
Ejemplo n.º 2
0
 public function testLoadFromArray()
 {
     $this->rule->loadFromArray(array('FREQ' => 'YEARLY', 'COUNT' => '2', 'INTERVAL' => '2', 'BYSECOND' => '30', 'BYMINUTE' => '10', 'BYHOUR' => '5,15', 'BYDAY' => 'SU,WE', 'BYMONTHDAY' => '16,22', 'BYYEARDAY' => '201,203', 'BYWEEKNO' => '29,32', 'BYMONTH' => '7,8', 'BYSETPOS' => '1,3', 'WKST' => 'TU', 'EXDATE' => '20140607,20140620T010000,20140620T160000Z'));
     $this->assertEquals(Frequency::YEARLY, $this->rule->getFreq());
     $this->assertEquals(2, $this->rule->getCount());
     $this->assertEquals(2, $this->rule->getInterval());
     $this->assertEquals(array(30), $this->rule->getBySecond());
     $this->assertEquals(array(10), $this->rule->getByMinute());
     $this->assertEquals(array(5, 15), $this->rule->getByHour());
     $this->assertEquals(array('SU', 'WE'), $this->rule->getByDay());
     $this->assertEquals(array(16, 22), $this->rule->getByMonthDay());
     $this->assertEquals(array(201, 203), $this->rule->getByYearDay());
     $this->assertEquals(array(29, 32), $this->rule->getByWeekNumber());
     $this->assertEquals(array(7, 8), $this->rule->getByMonth());
     $this->assertEquals(array(1, 3), $this->rule->getBySetPosition());
     $this->assertEquals('TU', $this->rule->getWeekStart());
     $this->assertEquals(array(new DateExclusion(new \DateTime(20140607), false), new DateExclusion(new \DateTime('20140620T010000'), true), new DateExclusion(new \DateTime('20140620 16:00:00 UTC'), true, true)), $this->rule->getExDates());
 }
Ejemplo n.º 3
0
 protected function addDaily(Rule $rule)
 {
     $interval = $rule->getInterval();
     if ($interval != 1) {
         $this->addFragment($interval);
     }
     $this->addFragment($this->isPlural($interval) ? 'days' : 'day');
     $byMonth = $rule->getByMonth();
     if (!empty($byMonth)) {
         $this->addFragment('in');
         $this->addByMonth($rule);
     }
     $byMonthDay = $rule->getByMonthDay();
     $byDay = $rule->getByDay();
     if (!empty($byMonthDay)) {
         $this->addByMonthDay($rule);
     } elseif (!empty($byDay)) {
         $this->addByDay($rule);
     }
 }
 protected function addDaily(Rule $rule)
 {
     $interval = $rule->getInterval();
     $byMonth = $rule->getByMonth();
     $this->addFragment($this->translator->trans($this->isPlural($interval) ? 'every %count% days' : 'every day', array('count' => $interval)));
     if (!empty($byMonth)) {
         $this->addFragment($this->translator->trans('in_month'));
         $this->addByMonth($rule);
     }
     $byMonthDay = $rule->getByMonthDay();
     $byDay = $rule->getByDay();
     if (!empty($byMonthDay)) {
         $this->addByMonthDay($rule);
         $this->addFragment($this->translator->trans('of_the_month'));
     } else {
         if (!empty($byDay)) {
             $this->addByDay($rule);
         }
     }
 }