diff options
author | Mario <mario@mariovavti.com> | 2019-04-25 11:24:09 +0200 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2019-04-25 11:24:09 +0200 |
commit | f1c07977809ce3221286d53e99f0d91145b1166f (patch) | |
tree | 4c067a3b701ea56f10070c386b26a30f93666eb0 /vendor/sabre/vobject/lib/Recur/RDateIterator.php | |
parent | 701167bc125700efb3e6ce759b85bcb4d36ee42e (diff) | |
download | volse-hubzilla-f1c07977809ce3221286d53e99f0d91145b1166f.tar.gz volse-hubzilla-f1c07977809ce3221286d53e99f0d91145b1166f.tar.bz2 volse-hubzilla-f1c07977809ce3221286d53e99f0d91145b1166f.zip |
Revert "update composer libs"
This reverts commit e779335d060b3a51d6a144d23af4097ae6801473
Diffstat (limited to 'vendor/sabre/vobject/lib/Recur/RDateIterator.php')
-rw-r--r-- | vendor/sabre/vobject/lib/Recur/RDateIterator.php | 73 |
1 files changed, 43 insertions, 30 deletions
diff --git a/vendor/sabre/vobject/lib/Recur/RDateIterator.php b/vendor/sabre/vobject/lib/Recur/RDateIterator.php index 013694b95..f44960e12 100644 --- a/vendor/sabre/vobject/lib/Recur/RDateIterator.php +++ b/vendor/sabre/vobject/lib/Recur/RDateIterator.php @@ -19,30 +19,29 @@ use Sabre\VObject\DateTimeParser; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class RDateIterator implements Iterator -{ +class RDateIterator implements Iterator { + /** * Creates the Iterator. * - * @param string|array $rrule + * @param string|array $rrule * @param DateTimeInterface $start */ - public function __construct($rrule, DateTimeInterface $start) - { + function __construct($rrule, DateTimeInterface $start) { + $this->startDate = $start; $this->parseRDate($rrule); $this->currentDate = clone $this->startDate; + } /* Implementation of the Iterator interface {{{ */ - public function current() - { - if (!$this->valid()) { - return; - } + function current() { + if (!$this->valid()) return; return clone $this->currentDate; + } /** @@ -50,9 +49,10 @@ class RDateIterator implements Iterator * * @return int */ - public function key() - { + function key() { + return $this->counter; + } /** @@ -61,35 +61,40 @@ class RDateIterator implements Iterator * * @return bool */ - public function valid() - { - return $this->counter <= count($this->dates); + function valid() { + + return ($this->counter <= count($this->dates)); + } /** * Resets the iterator. + * + * @return void */ - public function rewind() - { + function rewind() { + $this->currentDate = clone $this->startDate; $this->counter = 0; + } /** * Goes on to the next iteration. + * + * @return void */ - public function next() - { - ++$this->counter; - if (!$this->valid()) { - return; - } + function next() { + + $this->counter++; + if (!$this->valid()) return; $this->currentDate = DateTimeParser::parse( $this->dates[$this->counter - 1], $this->startDate->getTimezone() ); + } /* End of Iterator implementation }}} */ @@ -99,9 +104,10 @@ class RDateIterator implements Iterator * * @return bool */ - public function isInfinite() - { + function isInfinite() { + return false; + } /** @@ -109,12 +115,15 @@ class RDateIterator implements Iterator * specified date. * * @param DateTimeInterface $dt + * + * @return void */ - public function fastForward(DateTimeInterface $dt) - { + function fastForward(DateTimeInterface $dt) { + while ($this->valid() && $this->currentDate < $dt) { $this->next(); } + } /** @@ -150,20 +159,24 @@ class RDateIterator implements Iterator * class with all the values. * * @param string|array $rrule + * + * @return void */ - protected function parseRDate($rdate) - { + protected function parseRDate($rdate) { + if (is_string($rdate)) { $rdate = explode(',', $rdate); } $this->dates = $rdate; + } /** - * Array with the RRULE dates. + * Array with the RRULE dates * * @var array */ protected $dates = []; + } |