slice() public method

Retrieve a slice of the values.
public slice ( integer $start, integer | null $amount ) : pinq\ITraversable
$start integer The amount of values to skip
$amount integer | null The amount of values to retrieve
return pinq\ITraversable
Esempio n. 1
0
 public function visitRange(Segments\Range $query)
 {
     $this->traversable = $this->traversable->slice($this->resolvedParameters[$query->getStartId()], $this->resolvedParameters[$query->getAmountId()]);
 }
Esempio n. 2
0
 /**
  * @dataProvider assocMixedValues
  */
 public function testThatSlicingReturnsTheCorrectSegmentOfDataAndPreservesKeys(\Pinq\ITraversable $traversable, array $data)
 {
     $values = $traversable->slice(3, 2);
     $this->assertMatches($values, array_slice($data, 3, 2, true));
 }