for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Ackintosh\Snidel\Result;
class Collection implements \ArrayAccess, \Iterator
{
/** @var \Ackintosh\Snidel\Result\Result[] */
private $results = array();
/** @var int */
private $position;
/**
* @param \Ackintosh\Snidel\Result\Result[]
*/
public function __construct($results)
foreach ($results as $f) {
$this->results[] = $f;
}
$this->position = 0;
* @return array
public function toArray()
return array_map(
function ($result) {
return $result->getReturn();
},
$this->results
);
* ArrayAccess interface
*
* @param mixed $offset
* @return bool
public function offsetExists($offset)
if (isset($this->results[$offset]) && $this->results[$offset] !== '') {
return true;
return false;
* @return mixed
public function offsetGet($offset)
if (!$this->offsetExists($offset)) {
return null;
return $this->results[$offset];
* @return void
public function offsetSet($offset, $value)
$this->results[$offset] = $value;
public function offsetUnset($offset)
unset($this->results[$offset]);
* Iterator interface
* @return \Ackintosh\Snidel\Fork
public function current()
return $this->results[$this->position];
* @return int
public function key()
return $this->position;
public function next()
++$this->position;
public function rewind()
public function valid()
return isset($this->results[$this->position]);