Upgrade to 3.3.0

This commit is contained in:
Bastian Allgeier
2019-11-05 09:35:58 +01:00
parent 447a9dd266
commit a431716732
186 changed files with 3068 additions and 1458 deletions

View File

@@ -2,6 +2,9 @@
namespace Kirby\Toolkit;
use ArrayIterator;
use IteratorAggregate;
/**
* Extended version of PHP's iterator
* class that builds the foundation of our
@@ -13,7 +16,7 @@ namespace Kirby\Toolkit;
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class Iterator implements \Iterator
class Iterator implements IteratorAggregate
{
/**
* The data array
@@ -32,6 +35,16 @@ class Iterator implements \Iterator
$this->data = $data;
}
/**
* Get an iterator for the items.
*
* @return \ArrayIterator
*/
public function getIterator()
{
return new ArrayIterator($this->data);
}
/**
* Returns the current key
*
@@ -95,7 +108,7 @@ class Iterator implements \Iterator
/**
* Checks if the current element is valid
*
* @return boolean
* @return bool
*/
public function valid(): bool
{
@@ -115,8 +128,8 @@ class Iterator implements \Iterator
/**
* Tries to find the index number for the given element
*
* @param mixed $needle the element to search for
* @return string|false the name of the key or false
* @param mixed $needle the element to search for
* @return string|false the name of the key or false
*/
public function indexOf($needle)
{
@@ -126,8 +139,8 @@ class Iterator implements \Iterator
/**
* Tries to find the key for the given element
*
* @param mixed $needle the element to search for
* @return string|false the name of the key or false
* @param mixed $needle the element to search for
* @return string|false the name of the key or false
*/
public function keyOf($needle)
{
@@ -137,8 +150,8 @@ class Iterator implements \Iterator
/**
* Checks by key if an element is included
*
* @param mixed $key
* @return boolean
* @param mixed $key
* @return bool
*/
public function has($key): bool
{
@@ -148,8 +161,8 @@ class Iterator implements \Iterator
/**
* Checks if the current key is set
*
* @param mixed $key the key to check
* @return boolean
* @param mixed $key the key to check
* @return bool
*/
public function __isset($key): bool
{