Documentation

DownloadSyncBuilder extends AbstractSyncBuilder
in package

Table of Contents

Properties

$baseDir  : string
$bucket  : string
$client  : S3Client
$concurrency  : int
$debug  : bool
$delimiter  : string
$directory  : string
$forcing  : bool
$keyPrefix  : string
$params  : array<string|int, mixed>
$resumable  : bool
$sourceConverter  : FilenameConverterInterface
$sourceIterator  : Iterator
$targetConverter  : FilenameConverterInterface

Methods

addRegexFilter()  : $this
Add a filename filter that uses a regular expression to filter out files that you do not wish to transfer.
allowResumableDownloads()  : self
Call this function to allow partial downloads to be resumed if the download was previously interrupted
build()  : AbstractSync
Builds a UploadSync or DownloadSync object
enableDebugOutput()  : $this
Enable debug mode
force()  : $this
Set to true to force transfers even if a file already exists and has not changed
getInstance()  : static
setBaseDir()  : $this
Set the base directory of the files being transferred. The base directory is removed from each file path before converting the file path to an object key or vice versa.
setBucket()  : $this
Set the bucket to use with the sync
setClient()  : $this
Set the Amazon S3 client object that will send requests
setConcurrency()  : $this
Set the number of files that can be transferred concurrently
setDelimiter()  : $this
Specify the delimiter used for the targeted filesystem (default delimiter is "/")
setDirectory()  : $this
Set the directory where the objects from be downloaded to
setKeyPrefix()  : $this
Specify a prefix to prepend to each Amazon S3 object key or the prefix where object are stored in a bucket
setOperationParams()  : $this
Specify an array of operation parameters to apply to each operation executed by the sync object
setSourceFilenameConverter()  : $this
Set a custom object key provider instead of building one internally
setSourceIterator()  : $this
Set a custom iterator that returns \SplFileInfo objects for the source data
setTargetFilenameConverter()  : $this
Set a custom object key provider instead of building one internally
addCustomParamListener()  : mixed
Add the custom param listener to a transfer object
addDebugListener()  : mixed
Add a listener to the sync object to output debug information while transferring
assertFileIteratorSet()  : mixed
Ensure that the base file iterator has been provided
createS3Iterator()  : OpendirIterator
Create an Amazon S3 file iterator based on the given builder settings
filterIterator()  : Iterator
Wraps a generated iterator in a filter iterator that removes directories
getDefaultSourceConverter()  : FilenameConverterInterface
getDefaultTargetConverter()  : FilenameConverterInterface
getTargetIterator()  : Iterator
specificBuild()  : AbstractSync
Hook to implement in subclasses
validateRequirements()  : mixed
Validate that the builder has the minimal requirements

Properties

$baseDir

protected string $baseDir

Base directory to remove from each file path before converting to an object name or file name

$concurrency

protected int $concurrency = 5

Number of files that can be transferred concurrently

$forcing

protected bool $forcing = false

Whether or not to only transfer modified or new files

$keyPrefix

protected string $keyPrefix = ''

Prefix at prepend to each Amazon S3 object key

$params

protected array<string|int, mixed> $params = array()

Custom parameters to add to each operation sent while transferring

$sourceIterator

protected Iterator $sourceIterator

Iterator that returns SplFileInfo objects to upload

Methods

addRegexFilter()

Add a filename filter that uses a regular expression to filter out files that you do not wish to transfer.

public addRegexFilter(string $search) : $this
Parameters
$search : string

Regular expression search (in preg_match format). Any filename that matches this regex will not be transferred.

Return values
$this

allowResumableDownloads()

Call this function to allow partial downloads to be resumed if the download was previously interrupted

public allowResumableDownloads() : self
Return values
self

enableDebugOutput()

Enable debug mode

public enableDebugOutput([bool|resource $enabledOrResource = true ]) : $this
Parameters
$enabledOrResource : bool|resource = true

Set to true or false to enable or disable debug output. Pass an opened fopen resource to write to instead of writing to standard out.

Return values
$this

force()

Set to true to force transfers even if a file already exists and has not changed

public force([bool $force = false ]) : $this
Parameters
$force : bool = false

Set to true to force transfers without checking if it has changed

Return values
$this

setBaseDir()

Set the base directory of the files being transferred. The base directory is removed from each file path before converting the file path to an object key or vice versa.

public setBaseDir(string $baseDir) : $this
Parameters
$baseDir : string

Base directory, which will be deleted from each uploaded object key

Return values
$this

setBucket()

Set the bucket to use with the sync

public setBucket(string $bucket) : $this
Parameters
$bucket : string

Amazon S3 bucket name

Return values
$this

setClient()

Set the Amazon S3 client object that will send requests

public setClient(S3Client $client) : $this
Parameters
$client : S3Client

Amazon S3 client

Return values
$this

setConcurrency()

Set the number of files that can be transferred concurrently

public setConcurrency(int $concurrency) : $this
Parameters
$concurrency : int

Number of concurrent transfers

Return values
$this

setDelimiter()

Specify the delimiter used for the targeted filesystem (default delimiter is "/")

public setDelimiter(string $delimiter) : $this
Parameters
$delimiter : string

Delimiter to use to separate paths

Return values
$this

setDirectory()

Set the directory where the objects from be downloaded to

public setDirectory(string $directory) : $this
Parameters
$directory : string

Directory

Return values
$this

setKeyPrefix()

Specify a prefix to prepend to each Amazon S3 object key or the prefix where object are stored in a bucket

public setKeyPrefix(string $keyPrefix) : $this

Can be used to upload files to a pseudo sub-folder key or only download files from a pseudo sub-folder

Parameters
$keyPrefix : string

Prefix for each uploaded key

Return values
$this

setOperationParams()

Specify an array of operation parameters to apply to each operation executed by the sync object

public setOperationParams(array<string|int, mixed> $params) : $this
Parameters
$params : array<string|int, mixed>

Associative array of PutObject (upload) GetObject (download) parameters

Return values
$this

setSourceFilenameConverter()

Set a custom object key provider instead of building one internally

public setSourceFilenameConverter(FileNameConverterInterface $converter) : $this
Parameters
$converter : FileNameConverterInterface

Filename to object key provider

Return values
$this

setSourceIterator()

Set a custom iterator that returns \SplFileInfo objects for the source data

public setSourceIterator(Iterator $iterator) : $this
Parameters
$iterator : Iterator
Return values
$this

setTargetFilenameConverter()

Set a custom object key provider instead of building one internally

public setTargetFilenameConverter(FileNameConverterInterface $converter) : $this
Parameters
$converter : FileNameConverterInterface

Filename to object key provider

Return values
$this

addDebugListener()

Add a listener to the sync object to output debug information while transferring

protected addDebugListener(AbstractSync $sync, mixed $resource) : mixed
Parameters
$sync : AbstractSync

Sync object to listen to

$resource : mixed

Where to write debug messages

assertFileIteratorSet()

Ensure that the base file iterator has been provided

protected assertFileIteratorSet() : mixed

filterIterator()

Wraps a generated iterator in a filter iterator that removes directories

protected filterIterator(Iterator $iterator) : Iterator
Parameters
$iterator : Iterator

Iterator to wrap

Tags
throws
UnexpectedValueException
Return values
Iterator

validateRequirements()

Validate that the builder has the minimal requirements

protected validateRequirements() : mixed
Tags
throws
RuntimeException

if the builder is not configured completely


        
On this page

Search results