for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Underscore\Mutator;
use Underscore\Collection;
use Underscore\Mutator;
class TapMutator extends Mutator
{
/**
* Invokes $callback with the wrapped value of collection as the first argument
* and then wraps it back.
*
* The purpose of this Mutator
* is to "tap into" a Mutator
* chain in order to
* perform operations on intermediate results within the chain.
* @param Collection $collection
* @param callable $iterator
* @return Collection
*/
public function __invoke($collection, $iterator)
call_user_func($iterator, $collection->toArray());
return $collection;
}