src/Subscriptions/Iterators/SyncIterator.php
public function process(Collection $items, Closure $cb, Closure $error = null): void
    {
        $items->each(function ($item) use ($cb, $error): void {
            try {
                $cb($item);
            } catch (Exception $e) {
                if (! $error) {
                    throw $e;
                }

                $error($e);
            }
        });
    }
public function process(Collection $items, Closure $cb, Closure $error = null): void
    {
        $items->each(function ($item) use ($cb, $error): void {
            try {
                $cb($item);
            } catch (Exception $e) {
                if (! $error) {
                    throw $e;
                }

                $error($e);
            }
        });
    }
public function process ( Collection $ items , Closure $ cb , Closure $ error = null ) : void { $ items -> each ( function ( $ item ) use ( $ cb , $ error ) : void { try { $ cb ( $ item ) ; } catch ( Exception $ e ) { if ( ! $ error ) { throw $ e ; } $ error ( $ e ) ; } } ) ; }
Process collection of items.

@param  \Illuminate\Support\Collection  $items
@param  \Closure  $cb
@param  \Closure|null  $error
@return void
Process collection of items .