Documentation

File extends Node
in package
implements IPatchSupport

File class.

Tags
copyright

Copyright (C) fruux GmbH (https://fruux.com/)

author

Evert Pot (http://evertpot.com/)

license

http://sabre.io/license/ Modified BSD License

Interfaces, Classes and Traits

IPatchSupport
This interface provides a way to modify only part of a target resource It may be used to update a file chunk, upload big a file into smaller chunks or resume an upload.

Table of Contents

$overrideName  : string
The overridden name of the node.
$path  : string
The path to the current node.
__construct()  : mixed
Sets up the node, expects a full path name.
delete()  : bool
Delete the current file.
get()  : resource
Returns the data.
getContentType()  : string|null
Returns the mime-type for a file.
getETag()  : string|null
Returns the ETag for a file.
getLastModified()  : int
Returns the last modification time, as a unix timestamp.
getName()  : string
Returns the name of the node.
getSize()  : int
Returns the size of the file, in bytes.
patch()  : string|null
Updates the file based on a range specification.
put()  : string
Updates the data.
setName()  : mixed
Renames the node.

Properties

$overrideName

The overridden name of the node.

protected string $overrideName

$path

The path to the current node.

protected string $path

Methods

__construct()

Sets up the node, expects a full path name.

public __construct(string $path[, string $overrideName = null ]) : mixed

If $overrideName is set, this node shows up in the tree under a different name. In this case setName() will be disabled.

Parameters
$path : string
$overrideName : string = null
Return values
mixed

delete()

Delete the current file.

public delete() : bool
Return values
bool

get()

Returns the data.

public get() : resource
Return values
resource

getContentType()

Returns the mime-type for a file.

public getContentType() : string|null

If null is returned, we'll assume application/octet-stream

Return values
string|null

getETag()

Returns the ETag for a file.

public getETag() : string|null

An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change. The ETag is an arbitrary string, but MUST be surrounded by double-quotes.

Return null if the ETag can not effectively be determined

Return values
string|null

getLastModified()

Returns the last modification time, as a unix timestamp.

public getLastModified() : int
Return values
int

getName()

Returns the name of the node.

public getName() : string
Return values
string

getSize()

Returns the size of the file, in bytes.

public getSize() : int
Return values
int

patch()

Updates the file based on a range specification.

public patch(resource|string $data, int $rangeType[, int $offset = null ]) : string|null

The first argument is the data, which is either a readable stream resource or a string.

The second argument is the type of update we're doing. This is either:

    1. append
    1. update based on a start byte
    1. update based on an end byte ; The third argument is the start or end byte.

After a successful put operation, you may choose to return an ETag. The ETAG must always be surrounded by double-quotes. These quotes must appear in the actual string you're returning.

Clients may use the ETag from a PUT request to later on make sure that when they update the file, the contents haven't changed in the mean time.

Parameters
$data : resource|string
$rangeType : int
$offset : int = null
Return values
string|null

put()

Updates the data.

public put(resource|string $data) : string

Data is a readable stream resource.

Parameters
$data : resource|string
Return values
string

setName()

Renames the node.

public setName(string $name) : mixed
Parameters
$name : string

The new name

Return values
mixed

Search results