append() public method

{@inheritDoc}
public append ( $values ) : pinq\ICollection
return pinq\ICollection
Example #1
0
 /**
  * @dataProvider oneToTen
  */
 public function testThatAppendedFilteredApplyJoinOperatesOnOriginalCollection(\Pinq\ICollection $collection, array $data)
 {
     $appendedReference = 3;
     $collection->append([&$appendedReference])->join(range(1, 10))->on(function ($outer, $inner) {
         return $inner <= $outer;
     })->apply(function (&$outer, $inner) {
         $outer *= $inner;
     });
     $this->assertMatchesValues($collection, [1 * 1, 2 * 1 * 2, 3 * 1 * 2 * 3, 4 * 1 * 2 * 3 * 4, 5 * 1 * 2 * 3 * 4 * 5, 6 * 1 * 2 * 3 * 4 * 5 * 6, 7 * 1 * 2 * 3 * 4 * 5 * 6 * 7, 8 * 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8, 9 * 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9, 10 * 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10]);
     $this->assertSame($appendedReference, 3 * 1 * 2 * 3);
 }