mirror of
https://github.com/twisterarmy/twister.git
synced 2025-03-12 21:31:26 +00:00
This commit is contained in:
parent
83876a166d
commit
1f0cf9ed3e
45
src/DatePeriod.php
Normal file
45
src/DatePeriod.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Twister;
|
||||
|
||||
use \DateTime; // http://php.net/manual/en/class.datetime.php
|
||||
|
||||
use IteratorAggregate; // http://php.net/manual/en/class.iteratoraggregate.php Interface to create an external Iterator.
|
||||
|
||||
class DateIterator extends DatePeriod implements IteratorAggregate
|
||||
{
|
||||
public function __construct($date)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->position = 0;
|
||||
}
|
||||
|
||||
public function rewind()
|
||||
{
|
||||
$this->position = 0;
|
||||
}
|
||||
|
||||
public function current()
|
||||
{
|
||||
return $this->array[$this->position];
|
||||
}
|
||||
|
||||
public function key()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function next()
|
||||
{
|
||||
++$this->position;
|
||||
}
|
||||
|
||||
public function valid()
|
||||
{
|
||||
return isset($this->array[$this->position]);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user