for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the ONGR package.
*
* (c) NFQ Technologies UAB <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ONGR\ElasticsearchBundle;
/**
* This class is a holder for collection of objects.
class Collection implements \Countable, \Iterator, \ArrayAccess
{
* @var array
private $elements = [];
* Constructor.
* @param array $elements
public function __construct(array $elements = [])
$this->elements = $elements;
}
* {@inheritdoc}
public function current()
return current($this->elements);
public function next()
next($this->elements);
public function key()
return key($this->elements);
public function valid()
return $this->offsetExists($this->key());
public function rewind()
reset($this->elements);
public function offsetExists($offset)
return array_key_exists($offset, $this->elements);
public function offsetGet($offset)
return $this->elements[$offset];
public function offsetSet($offset, $value)
if ($offset === null) {
$this->elements[] = $value;
} else {
$this->elements[$offset] = $value;
public function offsetUnset($offset)
unset($this->elements[$offset]);
public function count()
return count($this->elements);