public function reverse() { $items = array_reverse($this->items); $col = new static($this->type); $col->setItemsFromTrustedSource($items); return $col; }
public function testReverse() { $c = new Collection('int', [1, 2, 3]); $r = $c->reverse(); $this->assertEquals([3, 2, 1], $r->toArray()); $this->assertEquals([1, 2, 3], $c->toArray()); }