for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of the Composite Utils package.
*
* (c) Emily Shepherd <[email protected]>
* For the full copyright and license information, please view the
* LICENSE.md file that was distributed with this source code.
* @package spaark/composite-utils
* @author Emily Shepherd <[email protected]>
* @license MIT
*/
namespace Spaark\CompositeUtils\Model\Collection;
use Spaark\CompositeUtils\Traits\AutoConstructTrait;
* Iterator for the HashMap datatype
* @generic KeyType
* @generic ValueType
class HashMapIterator extends MapIterator
{
use AutoConstructTrait;
* @var Pair<KeyType, ValueType>[]
* @construct required
protected $data;
* {@inheritDoc}
public function getCurrent() : Pair
return current($this->data);
}
public function rewind()
reset($this->data);
public function valid()
return key($this->data) !== NULL;
public function next()
$next = next($this->data);
return $next ? $next->value : null;