public get ( string $label = null ) : ArrayIterator | ||
$label | string | |
return | ArrayIterator |
public function get($label = null)
{
if ($label && array_key_exists($label, $this->results)) {
return $this->results[$label];
} else {
$results = [];
foreach ($this->results as $v) {
if (is_array($v)) {
$results = array_merge($results, $v);
} else {
$results[] = $v;
}
}
return $results;
}
}
public function testNoLabelFetch() { $array1 = ['test1', 'test2', 'test3']; $array2 = ['test4', 'test5', 'test6']; $set = new QueryResultset(); $set->add($array1); $set->add($array2); $this->assertEquals(6, count($set->get())); }