apply() public method

Walks the elements with the supplied function.
public apply ( callable $function ) : void
$function callable
return void
示例#1
0
 /**
  * @dataProvider arraysOfString
  */
 public function testThatCollectionApplyWorks(\Pinq\ICollection $collection, array $data)
 {
     $collection->apply(function (&$i) {
         sort($i);
     });
     $this->assertMatches($collection, [['b', 'd', 'l', 'q'], ['a', 'a', 'c', 'd'], ['d', 'd', 'f', 'q'], ['a', 'm', 't', 'v']]);
 }
示例#2
0
 public function visitApply(Operations\Apply $operation)
 {
     $this->collection->apply($this->parameters[$operation->getMutatorFunction()->getCallableId()]);
 }