public function eachPayment($callback)
    {
        if (!is_callable($callback)) {
            throw new \InvalidArgumentException("Argument must be callable");
        }
        foreach ($this->payments as $payment) {
            call_user_func_array($callback, array($payment));
        }
    }
public function eachPayment($callback)
    {
        if (!is_callable($callback)) {
            throw new \InvalidArgumentException("Argument must be callable");
        }
        foreach ($this->payments as $payment) {
            call_user_func_array($callback, array($payment));
        }
    }
public function eachPayment ( $ callback ) { if ( ! is_callable ( $ callback ) ) { throw new \ InvalidArgumentException ( "Argument must be callable" ) ; } foreach ( $ this -> payments as $ payment ) { call_user_func_array ( $ callback , array ( $ payment ) ) ; } }
Loop the payments with a custom callback
@param  callable $callback A function to be called on each payment
Loop the payments with a custom callback