FileAccess Orion

Client extends AbstractTus
in package

Table of Contents

TUS_PROTOCOL_VERSION  = '1.0.0'
UPLOAD_TYPE_FINAL  = 'final'
UPLOAD_TYPE_PARTIAL  = 'partial'
HEADER_CONTENT_TYPE  = 'application/offset+octet-stream'
PARTIAL_UPLOAD_NAME_SEPARATOR  = '_'
UPLOAD_TYPE_NORMAL  = 'normal'
$apiPath  : string
$cache  : Cacheable
$checksum  : string
$checksumAlgorithm  : string
$client  : Client
$dispatcher  : EventDispatcherInterface
$fileName  : string
$filePath  : string
$fileSize  : int
$key  : string
$metadata  : array<string|int, mixed>
$partial  : bool
$partialOffset  : int
$url  : string
__construct()  : mixed
Client constructor.
addMetadata()  : Client
Add metadata.
concat()  : string
Concatenate 2 or more partial uploads.
create()  : string
Create resource with POST request.
delete()  : void
Send DELETE request.
event()  : EventDispatcherInterface
Set and get event dispatcher.
file()  : Client
Set file properties.
getApiPath()  : string
Get API path.
getCache()  : Cacheable
Get cache.
getChecksum()  : string
Get checksum.
getChecksumAlgorithm()  : string
Get checksum algorithm.
getClient()  : Client
Get guzzle client.
getFileName()  : string|null
Get file name.
getFilePath()  : string|null
Get file path.
getFileSize()  : int
Get file size.
getKey()  : string
Get key.
getMetadata()  : array<string|int, mixed>
Get metadata.
getOffset()  : bool|int
Returns offset if file is partially uploaded.
getPartialOffset()  : int
Get partial offset.
getUrl()  : string|null
Get url.
isExpired()  : bool
Check if current upload is expired.
isPartial()  : bool
Check if this is a partial upload request.
removeMetadata()  : Client
Remove metadata.
seek()  : self
Set offset and force this to be a partial upload request.
setApiPath()  : self
Set API path.
setCache()  : self
Set cache.
setChecksum()  : Client
Set checksum.
setChecksumAlgorithm()  : Client
Set checksum algorithm.
setDispatcher()  : self
Set event dispatcher.
setFileName()  : Client
Set file name.
setKey()  : Client
Set key.
setMetadata()  : Client
Set metadata.
upload()  : int
Upload file.
getData()  : string
Get X bytes of data from file.
getUploadChecksumHeader()  : string
Get upload checksum header.
getUploadMetadataHeader()  : string
Get metadata for Upload-Metadata header.
handleClientException()  : mixed
Handle client exception during patch request.
partial()  : void
Set as partial request.
sendHeadRequest()  : int
Send HEAD request.
sendPatchRequest()  : int
Send PATCH request.

Constants

TUS_PROTOCOL_VERSION

public mixed TUS_PROTOCOL_VERSION = '1.0.0'
Tags
const

string Tus protocol version.

UPLOAD_TYPE_FINAL

public mixed UPLOAD_TYPE_FINAL = 'final'
Tags
const

string Upload type final.

UPLOAD_TYPE_PARTIAL

public mixed UPLOAD_TYPE_PARTIAL = 'partial'
Tags
const

string Upload type partial.

HEADER_CONTENT_TYPE

protected mixed HEADER_CONTENT_TYPE = 'application/offset+octet-stream'
Tags
const

string Header Content Type

PARTIAL_UPLOAD_NAME_SEPARATOR

protected mixed PARTIAL_UPLOAD_NAME_SEPARATOR = '_'
Tags
const

string Name separator for partial upload.

UPLOAD_TYPE_NORMAL

protected mixed UPLOAD_TYPE_NORMAL = 'normal'
Tags
const

string Upload type normal.

Properties

$checksum

protected string $checksum

$checksumAlgorithm

protected string $checksumAlgorithm = 'sha256'

$fileName

protected string $fileName

$filePath

protected string $filePath

$fileSize

protected int $fileSize = 0

$metadata

protected array<string|int, mixed> $metadata = []

$partial

protected bool $partial = false

$partialOffset

protected int $partialOffset = -1

Methods

__construct()

Client constructor.

public __construct(string $baseUri[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$baseUri : string
$options : array<string|int, mixed> = []
Tags
throws
ReflectionException
Return values
mixed

addMetadata()

Add metadata.

public addMetadata(string $key, string $value) : Client
Parameters
$key : string
$value : string
Return values
Client

concat()

Concatenate 2 or more partial uploads.

public concat(string $key, mixed ...$partials) : string
Parameters
$key : string
$partials : mixed
Return values
string

create()

Create resource with POST request.

public create(string $key) : string
Parameters
$key : string
Tags
throws
FileException
Return values
string

delete()

Send DELETE request.

public delete() : void
Tags
throws
FileException
Return values
void

file()

Set file properties.

public file(string $file[, string $name = null ]) : Client
Parameters
$file : string

File path.

$name : string = null

File name.

Return values
Client

getApiPath()

Get API path.

public getApiPath() : string
Return values
string

getChecksum()

Get checksum.

public getChecksum() : string
Return values
string

getChecksumAlgorithm()

Get checksum algorithm.

public getChecksumAlgorithm() : string
Return values
string

getFileName()

Get file name.

public getFileName() : string|null
Return values
string|null

getFilePath()

Get file path.

public getFilePath() : string|null
Return values
string|null

getFileSize()

Get file size.

public getFileSize() : int
Return values
int

getKey()

Get key.

public getKey() : string
Return values
string

getMetadata()

Get metadata.

public getMetadata() : array<string|int, mixed>
Return values
array<string|int, mixed>

getOffset()

Returns offset if file is partially uploaded.

public getOffset() : bool|int
Return values
bool|int

getPartialOffset()

Get partial offset.

public getPartialOffset() : int
Return values
int

getUrl()

Get url.

public getUrl() : string|null
Return values
string|null

isExpired()

Check if current upload is expired.

public isExpired() : bool
Return values
bool

isPartial()

Check if this is a partial upload request.

public isPartial() : bool
Return values
bool

removeMetadata()

Remove metadata.

public removeMetadata(string $key) : Client
Parameters
$key : string
Return values
Client

seek()

Set offset and force this to be a partial upload request.

public seek(int $offset) : self
Parameters
$offset : int
Return values
self

setApiPath()

Set API path.

public setApiPath(string $path) : self
Parameters
$path : string
Return values
self

setCache()

Set cache.

public setCache(mixed $cache) : self
Parameters
$cache : mixed
Tags
throws
ReflectionException
Return values
self

setChecksum()

Set checksum.

public setChecksum(string $checksum) : Client
Parameters
$checksum : string
Return values
Client

setChecksumAlgorithm()

Set checksum algorithm.

public setChecksumAlgorithm(string $algorithm) : Client
Parameters
$algorithm : string
Return values
Client

setFileName()

Set file name.

public setFileName(string $name) : Client
Parameters
$name : string
Return values
Client

setKey()

Set key.

public setKey(string $key) : Client
Parameters
$key : string
Return values
Client

setMetadata()

Set metadata.

public setMetadata(array<string|int, mixed> $items) : Client
Parameters
$items : array<string|int, mixed>
Return values
Client

getData()

Get X bytes of data from file.

protected getData(int $offset, int $bytes) : string
Parameters
$offset : int
$bytes : int
Return values
string

getUploadChecksumHeader()

Get upload checksum header.

protected getUploadChecksumHeader() : string
Return values
string

getUploadMetadataHeader()

Get metadata for Upload-Metadata header.

protected getUploadMetadataHeader() : string
Return values
string

handleClientException()

Handle client exception during patch request.

protected handleClientException(ClientException $e) : mixed
Parameters
$e : ClientException
Return values
mixed

partial()

Set as partial request.

protected partial([bool $state = true ]) : void
Parameters
$state : bool = true
Return values
void

sendHeadRequest()

Send HEAD request.

protected sendHeadRequest() : int
Tags
throws
FileException
Return values
int

Search results