class Asset extends LocalizedResource implements AssetInterface

Properties

protected string[] $localeCodes List of codes for all the locales available in the space this resource belongs to. from LocalizedResource
protected Asset $sys
protected string[] $title
protected string[] $description
protected FileInterface[] $file

Methods

__construct(array $data)

Resources in this SDK should not be built using $new Class().

Link
asLink()

{@inheritdoc}

string
getId()

{@inheritdoc}

string
getType()

{@inheritdoc}

initLocales(array $locales)

No description

$this
setLocale(Locale|string $locale)

Set the locale for this instance.

string
getLocale()

The locale code for the currently set locale.

string
getLocaleFromInput(Locale|string|null $input = \null)

No description

string|null
walkFallbackChain(array $valueMap, string $localeCode, Environment $environment)

No description

getSystemProperties()

{@inheritdoc}

getSpace()

Returns the space this asset belongs to.

getEnvironment()

Returns the environment this asset belongs to.

string|null
getTitle(Locale|string|null $locale = \null)

No description

string|null
getDescription(Locale|string|null $locale = \null)

No description

FileInterface|null
getFile(Locale|string|null $locale = \null)

No description

array
jsonSerialize()

{@inheritdoc}

Details

in BaseResource at line 26
protected __construct(array $data)

Resources in this SDK should not be built using $new Class().

This method is only useful in testing environments, where the resource needs to be subclasses and this method made public.

Parameters

array $data

{@inheritdoc}

Return Value

Link

in BaseResource at line 49
string getId()

{@inheritdoc}

Return Value

string

in BaseResource at line 57
string getType()

{@inheritdoc}

Return Value

string

in LocalizedResource at line 41
initLocales(array $locales)

Parameters

array $locales The locales available in the space this resource belongs to

in LocalizedResource at line 65
$this setLocale(Locale|string $locale)

Set the locale for this instance.

All future calls to a getter will return the information for this locale.

Parameters

Locale|string $locale The locale code as string or an instance of Locale

Return Value

$this

in LocalizedResource at line 79
string getLocale()

The locale code for the currently set locale.

It will be either the default locale if the resource was fetched using "locale=*", or the one that was used in the API request.

Return Value

string

in LocalizedResource at line 91
protected string getLocaleFromInput(Locale|string|null $input = \null)

Parameters

Locale|string|null $input

Return Value

string

Exceptions

InvalidArgumentException when $locale is not one of the locales supported by the space

in LocalizedResource at line 130
protected string|null walkFallbackChain(array $valueMap, string $localeCode, Environment $environment)

Parameters

array $valueMap
string $localeCode
Environment $environment

Return Value

string|null the locale code for which a value can be found, or null if the end of the chain was reached

Exceptions

RuntimeException If we detect an endless loop

at line 43
Asset getSystemProperties()

{@inheritdoc}

Return Value

Asset

at line 53
Space getSpace()

Returns the space this asset belongs to.

Return Value

Space

at line 63
Environment getEnvironment()

Returns the environment this asset belongs to.

Return Value

Environment

at line 73
string|null getTitle(Locale|string|null $locale = \null)

Parameters

Locale|string|null $locale

Return Value

string|null

at line 86
string|null getDescription(Locale|string|null $locale = \null)

Parameters

Locale|string|null $locale

Return Value

string|null

at line 99
FileInterface|null getFile(Locale|string|null $locale = \null)

Parameters

Locale|string|null $locale

Return Value

FileInterface|null

at line 135
array jsonSerialize()

{@inheritdoc}

Return Value

array