Beispiel #1
0
 /**
  * Check if the current position is valid.
  *
  * @return bool
  */
 public function valid()
 {
     return $this->date->timestamp() <= $this->end;
 }
Beispiel #2
0
 /**
  * Create a new iterator for the number of seconds in a range.
  *
  * @param DateTime $start The start date of the range
  * @param DateTime $end The end date of the range
  */
 public function __construct(DateTime $start, DateTime $end)
 {
     $this->start = $start->timestamp();
     $this->end = $end->timestamp();
     $this->rewind();
 }
Beispiel #3
0
 /**
  * Create a new iterator for the number of hours in a range.
  *
  * @param DateTime $start The start date of the range
  * @param DateTime $end The end date of the range
  */
 public function __construct(DateTime $start, DateTime $end)
 {
     $this->start = $start->withMinutes(0)->withSeconds(0)->timestamp();
     $this->end = $end->withMinutes(0)->withSeconds(0)->timestamp();
     $this->rewind();
 }