/** * Lazy fetching sequence * * @param int $limit * @param int $page * @return util.data.Sequence */ protected function records($limit = self::PAGE, $page = 0) { $records = $this->loadPage($page * $limit, $limit); return Sequence::concat($records, sizeof($records) < $limit ? null : function () use($page, $limit) { return $this->records($limit, ++$page); }); }
public function concat_iteratively() { $seq = Sequence::$EMPTY; foreach ([[1, 2], [3, 4], [5, 6]] as $array) { $seq = Sequence::concat($seq, Sequence::of($array)); } $this->assertSequence([1, 2, 3, 4, 5, 6], $seq); }