src/S3/BatchDelete.php
public static function fromListObjects(
        AwsClientInterface $client,
        array $listObjectsParams,
        array $options = []
    ) {
        $iter = $client->getPaginator('ListObjects', $listObjectsParams);
        $bucket = $listObjectsParams['Bucket'];
        $fn = function (BatchDelete $that) use ($iter) {
            return $iter->each(function ($result) use ($that) {
                $promises = [];
                if (is_array($result['Contents'])) {
                    foreach ($result['Contents'] as $object) {
                        if ($promise = $that->enqueue($object)) {
                            $promises[] = $promise;
                        }
                    }
                }
                return $promises ? Promise\all($promises) : null;
            });
        };

        return new self($client, $bucket, $fn, $options);
    }
public static function fromListObjects(
        AwsClientInterface $client,
        array $listObjectsParams,
        array $options = []
    ) {
        $iter = $client->getPaginator('ListObjects', $listObjectsParams);
        $bucket = $listObjectsParams['Bucket'];
        $fn = function (BatchDelete $that) use ($iter) {
            return $iter->each(function ($result) use ($that) {
                $promises = [];
                if (is_array($result['Contents'])) {
                    foreach ($result['Contents'] as $object) {
                        if ($promise = $that->enqueue($object)) {
                            $promises[] = $promise;
                        }
                    }
                }
                return $promises ? Promise\all($promises) : null;
            });
        };

        return new self($client, $bucket, $fn, $options);
    }
public static function fromListObjects ( AwsClientInterface $ client , array $ listObjectsParams , array $ options = [ ] ) { $ iter = $ client -> getPaginator ( 'ListObjects' , $ listObjectsParams ) ; $ bucket = $ listObjectsParams [ 'Bucket' ] ; $ fn = function ( BatchDelete $ that ) use ( $ iter ) { return $ iter -> each ( function ( $ result ) use ( $ that ) { $ promises = [ ] ; if ( is_array ( $ result [ 'Contents' ] ) ) { foreach ( $ result [ 'Contents' ] as $ object ) { if ( $ promise = $ that -> enqueue ( $ object ) ) { $ promises [ ] = $ promise ; } } } return $ promises ? Promise \ all ( $ promises ) : null ; } ) ; } ; return new self ( $ client , $ bucket , $ fn , $ options ) ; }
Creates a BatchDelete object from all of the paginated results of a
ListObjects operation. Each result that is returned by the ListObjects
operation will be deleted.

@param AwsClientInterface $client            AWS Client to use.
@param array              $listObjectsParams ListObjects API parameters
@param array              $options           BatchDelete options.

@return BatchDelete
Creates a BatchDelete object from all of the paginated results of a ListObjects operation . Each result that is returned by the ListObjects operation will be deleted .