class StorageObject implements ResourceMetaDataInterface (View source)

An Object which is stored in a Storage

This class is used internally as a representation of the actual storage data.

The main purpose for Object is to transfer data and meta data from a storage to a publishing target. It must not be used outside the resource management framework.

Properties

protected string $mediaType

The IANA media type of the stored data

protected string $filename

The suggested filename

protected int $fileSize

The size of this object's data

protected string $relativePublicationPath

A suggested relative path for publication of this data

protected string $sha1

SHA1 hash identifying this object's data

protected string $md5

MD5 hash identifying this object's data

protected Closure|resource $stream

A stream (or, before it is used the first time, a Closure which returns a stream) which can deliver the data of this Object

Methods

void
setMediaType(string $mediaType)

Set the IANA media type of this Object

string
getMediaType()

Retrieve the IANA media type of this Object

void
setFilename(string $filename)

Set the suggested filename of this Object

string
getFilename()

Retrieve the suggested filename of this Object

void
setRelativePublicationPath(string $relativePublicationPath)

Set the suggested relative publication path

string
getRelativePublicationPath()

Retrieve the suggested relative publication path

string
getFileSize()

Returns the size of the content of this storage object

void
setFileSize(string $fileSize)

Sets the size of the content of this storage object

void
setSha1(string $sha1)

Set the SHA1 hash identifying the data of this Object

string
getSha1()

Retrieve the SHA1 hash identifying the data of this object

string
getMd5() deprecated

Returns the md5 hash of the content of this storage object

void
setMd5(string $md5) deprecated

Sets the md5 hash of the content of this storage object

void
setStream(resource|Closure $stream)

Sets the data stream which can deliver the content of this storage object

resource
getStream()

Returns the data stream which can deliver the content of this storage object

Details

void setMediaType(string $mediaType)

Set the IANA media type of this Object

Parameters

string $mediaType

Return Value

void

string getMediaType()

Retrieve the IANA media type of this Object

Return Value

string

The IANA Media Type

void setFilename(string $filename)

Set the suggested filename of this Object

Parameters

string $filename

Return Value

void

string getFilename()

Retrieve the suggested filename of this Object

Return Value

string

The filename

void setRelativePublicationPath(string $relativePublicationPath)

Set the suggested relative publication path

Parameters

string $relativePublicationPath

Return Value

void

string getRelativePublicationPath()

Retrieve the suggested relative publication path

Return Value

string

string getFileSize()

Returns the size of the content of this storage object

Return Value

string

The md5 hash

void setFileSize(string $fileSize)

Sets the size of the content of this storage object

Parameters

string $fileSize

The content size

Return Value

void

void setSha1(string $sha1)

Set the SHA1 hash identifying the data of this Object

Parameters

string $sha1

The sha1 hash

Return Value

void

string getSha1()

Retrieve the SHA1 hash identifying the data of this object

Return Value

string

The sha1 hash

string getMd5() deprecated

deprecated since 6.3, will be removed with 7.0 – use getSha1() instead or md5(stream_get_contents($resource->getStream())) if you need an MD5 hash

Returns the md5 hash of the content of this storage object

Return Value

string

The md5 hash

void setMd5(string $md5) deprecated

deprecated since 6.3, will be removed with 7.0 – @see getMd5()

Sets the md5 hash of the content of this storage object

Parameters

string $md5

The md5 hash

Return Value

void

void setStream(resource|Closure $stream)

Sets the data stream which can deliver the content of this storage object

Instead of providing a stream (PHP resource), you can also pass a Closure which returns a stream when it is evaluated.

Parameters

resource|Closure $stream

The data stream, or a Closure which returns one

Return Value

void

resource getStream()

Returns the data stream which can deliver the content of this storage object

Return Value

resource

A data stream resource; if the stream is seekable, it is rewound to the start