ClearBucket
extends AbstractHasDispatcher
in package
Class used to clear the contents of a bucket or the results of an iterator
Table of Contents
Constants
- AFTER_CLEAR = 'clear_bucket.after_clear'
- AFTER_DELETE = 'clear_bucket.after_delete'
- BEFORE_CLEAR = 'clear_bucket.before_clear'
Properties
- $client : AwsClientInterface
- $eventDispatcher : EventDispatcherInterface
- $iterator : AbstractS3ResourceIterator
- $mfa : string
Methods
- __construct() : mixed
- addSubscriber() : self
- Add an event subscriber to the dispatcher
- clear() : int
- Clear the bucket
- dispatch() : Event
- Helper to dispatch Guzzle events and set the event name on the event
- getAllEvents() : array<string|int, mixed>
- Get a list of all of the events emitted from the class
- getEventDispatcher() : EventDispatcherInterface
- Get the EventDispatcher of the request
- getIterator() : Iterator
- Get the iterator used to yield the keys to be deleted. A default iterator will be created and returned if no iterator has been explicitly set.
- setBucket() : $this
- Set the bucket that is to be cleared
- setEventDispatcher() : self
- Set the EventDispatcher of the request
- setIterator() : $this
- Sets a different iterator to use than the default iterator. This can be helpful when you wish to delete only specific keys from a bucket (e.g. keys that match a certain prefix or delimiter, or perhaps keys that pass through a filtered, decorated iterator).
- setMfa() : $this
- Set the MFA token to send with each request
Constants
AFTER_CLEAR
public
string
AFTER_CLEAR
= 'clear_bucket.after_clear'
Event emitted after the bucket is cleared
AFTER_DELETE
public
string
AFTER_DELETE
= 'clear_bucket.after_delete'
Event emitted when a batch request has completed
BEFORE_CLEAR
public
string
BEFORE_CLEAR
= 'clear_bucket.before_clear'
Event emitted before the bucket is cleared
Properties
$client
protected
AwsClientInterface
$client
Client used to execute the requests
$eventDispatcher
protected
EventDispatcherInterface
$eventDispatcher
$iterator
protected
AbstractS3ResourceIterator
$iterator
Iterator used to yield keys
$mfa
protected
string
$mfa
MFA used with each request
Methods
__construct()
public
__construct(AwsClientInterface $client, string $bucket) : mixed
Parameters
- $client : AwsClientInterface
-
Client used to execute requests
- $bucket : string
-
Name of the bucket to clear
addSubscriber()
Add an event subscriber to the dispatcher
public
addSubscriber(EventSubscriberInterface $subscriber) : self
Parameters
- $subscriber : EventSubscriberInterface
-
Event subscriber
Return values
selfclear()
Clear the bucket
public
clear() : int
Tags
Return values
int —Returns the number of deleted keys
dispatch()
Helper to dispatch Guzzle events and set the event name on the event
public
dispatch(mixed $eventName[, array<string|int, mixed> $context = array() ]) : Event
Parameters
- $eventName : mixed
-
Name of the event to dispatch
- $context : array<string|int, mixed> = array()
-
Context of the event
Return values
Event —Returns the created event object
getAllEvents()
Get a list of all of the events emitted from the class
public
static getAllEvents() : array<string|int, mixed>
Return values
array<string|int, mixed>getEventDispatcher()
Get the EventDispatcher of the request
public
getEventDispatcher() : EventDispatcherInterface
Return values
EventDispatcherInterfacegetIterator()
Get the iterator used to yield the keys to be deleted. A default iterator will be created and returned if no iterator has been explicitly set.
public
getIterator() : Iterator
Return values
IteratorsetBucket()
Set the bucket that is to be cleared
public
setBucket(string $bucket) : $this
Parameters
- $bucket : string
-
Name of the bucket to clear
Return values
$thissetEventDispatcher()
Set the EventDispatcher of the request
public
setEventDispatcher(EventDispatcherInterface $eventDispatcher) : self
Parameters
- $eventDispatcher : EventDispatcherInterface
Return values
selfsetIterator()
Sets a different iterator to use than the default iterator. This can be helpful when you wish to delete only specific keys from a bucket (e.g. keys that match a certain prefix or delimiter, or perhaps keys that pass through a filtered, decorated iterator).
public
setIterator(Iterator $iterator) : $this
Parameters
- $iterator : Iterator
-
Iterator used to yield the keys to be deleted
Return values
$thissetMfa()
Set the MFA token to send with each request
public
setMfa(string $mfa) : $this
Parameters
- $mfa : string
-
MFA token to send with each request. The value is the concatenation of the authentication device's serial number, a space, and the value displayed on your authentication device.