public function accumulate(callable $callback, $accumulator = "")
    {
        foreach($this->_data as $key => $value) {
            $accumulator = $callback($key, $value, $accumulator);
        }

        return $accumulator;
    }
public function accumulate(callable $callback, $accumulator = "")
    {
        foreach($this->_data as $key => $value) {
            $accumulator = $callback($key, $value, $accumulator);
        }

        return $accumulator;
    }
public function accumulate ( callable $ callback , $ accumulator = "" ) { foreach ( $ this -> _data as $ key => $ value ) { $ accumulator = $ callback ( $ key , $ value , $ accumulator ) ; } return $ accumulator ; }
Performs a `array_reduce` action with the array.

This method loops through the array and executes the callback
on each element.

The difference between `accumulate` and `map` and `filter` is that
this method sends the result of each call to the callback as
a second parameter to the callback.

Example:

```php
$arr = new \Alexya\Tools\Collection([
"test",
"foo",
"bar",
"tests"
]);

$arr->accumulate(function($key, $value, $accumulator) {
echo "Previous value {$accumulator}, current value {$value}";

return $value;
}, "");
// Previous value , current value test
// Previous value test, current value foo
// Previous value foo, current value bar
// Previous value bar, current value tests
```

@param callable $callback    Callback to apply to each element.
@param mixed    $accumulator Initial accumulator.

@return mixed The resulting $accumulator.
Performs a array_reduce action with the array .