コード例 #1
0
 public function testDateRangeExclusiveIteration()
 {
     $expected = array(date_create('2014-09-01T03:00:00+00:00'), date_create('2014-09-01T03:15:00+00:00'), date_create('2014-09-01T03:30:00+00:00'), date_create('2014-09-01T03:45:00+00:00'), date_create('2014-09-01T04:00:00+00:00'));
     $end = date_create('2014-09-01T04:15:00+00:00');
     $range = new DateRangeExclusive($expected[0], $end, new DateInterval('PT15M'));
     foreach ($range->iterable() as $value) {
         $this->assertEquals(array_shift($expected), $value);
     }
     $this->assertEquals(0, count($expected));
 }
コード例 #2
0
 /**
  * @param \DateTime     $start
  * @param \DateTime     $end
  * @param \DateInterval $step
  */
 public function __construct(DateTime $start, DateTime $end = null, DateInterval $step = null)
 {
     parent::__construct($start, $end, $step);
     $this->end->add($this->step);
 }