class Asset extends BaseResource implements Creatable, Updatable, Deletable, Publishable, Archivable

Asset class.

This class represents a resource with type "Asset" in Contentful.

Properties

protected SystemProperties $sys from BaseResource
protected BaseProxy $proxy from BaseResource
protected string[] $title
protected string[] $description
protected FileInterface[] $file

Methods

__construct()

Asset constructor.

getSystemProperties()

Returns the resource's system properties, defined in the object "sys" in Contentful's responses.

string|null
getId()

Shortcut for accessing the resource ID through its system properties.

Link
asLink()

Creates a Link representation of the current resource.

setProxy(BaseProxy $proxy)

Sets the current BaseProxy object instance.

asRequestBody()

{@inheritdoc}

__call(string $name, array $arguments)

Shortcut for forwarding methods to the current proxy, using the current object as argument.

array
jsonSerialize()

Returns an array to be used by "json_encode" to serialize objects of this class.

string|null
getTitle(string $locale)

No description

setTitle(string $locale, string $title = null)

No description

string[]
getTitles()

No description

string|null
getDescription(string $locale)

No description

setDescription(string $locale, string $description = null)

No description

string[]
getDescriptions()

No description

FileInterface|null
getFile(string $locale)

No description

setFile(string $locale, UnprocessedFileInterface $file = null)

No description

FileInterface[]
getFiles()

No description

Details

at line 47
__construct()

Asset constructor.

in BaseResource at line 47
SystemProperties getSystemProperties()

Returns the resource's system properties, defined in the object "sys" in Contentful's responses.

Return Value

SystemProperties

in BaseResource at line 57
string|null getId()

Shortcut for accessing the resource ID through its system properties.

Return Value

string|null

Creates a Link representation of the current resource.

Return Value

Link

in BaseResource at line 79
BaseResource setProxy(BaseProxy $proxy)

Sets the current BaseProxy object instance.

This is done automatically when performing API calls, so it shouldn't be used manually.

Parameters

BaseProxy $proxy

Return Value

BaseResource

in BaseResource at line 89
asRequestBody()

{@inheritdoc}

in BaseResource at line 111
__call(string $name, array $arguments)

Shortcut for forwarding methods to the current proxy, using the current object as argument.

// Instead of
$client->asset->publish($asset);
// You can use
$asset->publish();

Parameters

string $name
array $arguments

at line 57
array jsonSerialize()

Returns an array to be used by "json_encode" to serialize objects of this class.

Return Value

array

at line 84
string|null getTitle(string $locale)

Parameters

string $locale

Return Value

string|null

at line 99
Asset setTitle(string $locale, string $title = null)

Parameters

string $locale
string $title

Return Value

Asset

at line 109
string[] getTitles()

Return Value

string[]

at line 119
string|null getDescription(string $locale)

Parameters

string $locale

Return Value

string|null

at line 134
Asset setDescription(string $locale, string $description = null)

Parameters

string $locale
string $description

Return Value

Asset

at line 144
string[] getDescriptions()

Return Value

string[]

at line 154
FileInterface|null getFile(string $locale)

Parameters

string $locale

Return Value

FileInterface|null

at line 169
Asset setFile(string $locale, UnprocessedFileInterface $file = null)

Parameters

string $locale
UnprocessedFileInterface $file

Return Value

Asset

at line 179
FileInterface[] getFiles()

Return Value

FileInterface[]