class AssetDescriptor implements AssetInterface

Class AssetDescriptor

Properties

string $assetType
string $deliveryType
int|string $version
string $location
string $filename
string $extension

Methods

__construct(string $publicId, string $assetType = AssetType::IMAGE)

AssetDescriptor constructor.

__get(string $name)

Gets inaccessible class property by name.

__isset(string $key)

Indicates whether the inaccessible class property is set.

__set(string $name, mixed $value)

Sets the inaccessible class property.

setPublicId(string $publicId)

Sets the public ID of the asset.

publicId(bool $noExtension = false)

Gets the public ID of the asset

setSuffix(string $suffix)

Sets the URL SEO suffix of the asset.

fromString(string $string)

Creates a new asset from the provided string (URL).

fromJson(string|array $json)

Creates a new asset from the provided JSON.

fromParams(string $source, array $params = [])

Creates a new asset from the provided source and an array of (legacy) parameters.

importString(string $string)

Imports data from the provided string (URL).

importJson(string|array $json)

Imports data from the provided JSON.

__toString()

Serializes to string.

jsonSerialize($includeEmptyKeys = false)

No description

Details

__construct(string $publicId, string $assetType = AssetType::IMAGE)

AssetDescriptor constructor.

Parameters

Name Type Description
$publicId string The public ID of the asset.
$assetType string The type of the asset.

mixed|null __get(string $name)

Gets inaccessible class property by name.

Parameters

Name Type Description
$name string The name of the property.

Return Value

mixed|null

bool __isset(string $key)

Indicates whether the inaccessible class property is set.

Parameters

Name Type Description
$key string The class property name.

Return Value

bool

__set(string $name, mixed $value)

Sets the inaccessible class property.

Parameters

Name Type Description
$name string The class property name.
$value mixed The class property value.

$this setPublicId(string $publicId)

Sets the public ID of the asset.

Parameters

Name Type Description
$publicId string The public ID of the asset.

Return Value

$this

string publicId(bool $noExtension = false)

Gets the public ID of the asset

Parameters

Name Type Description
$noExtension bool When true, omits file extension.

Return Value

string

$this setSuffix(string $suffix)

Sets the URL SEO suffix of the asset.

Parameters

Name Type Description
$suffix string The SEO suffix.

Return Value

$this

static mixed fromString(string $string)

Creates a new asset from the provided string (URL).

Parameters

Name Type Description
$string string The asset string (URL).

Return Value

mixed

static mixed fromJson(string|array $json)

Creates a new asset from the provided JSON.

Parameters

Name Type Description
$json string|array The asset json. Can be an array or a JSON string.

Return Value

mixed

static mixed fromParams(string $source, array $params = [])

Creates a new asset from the provided source and an array of (legacy) parameters.

Parameters

Name Type Description
$source string The public ID of the asset.
$params array The asset parameters.

Return Value

mixed

mixed importString(string $string)

Imports data from the provided string (URL).

Parameters

Name Type Description
$string string The asset string (URL).

Return Value

mixed

AssetDescriptor importJson(string|array $json)

Imports data from the provided JSON.

Parameters

Name Type Description
$json string|array The asset json. Can be an array or a JSON string.

Return Value

AssetDescriptor

string __toString()

Serializes to string.

Return Value

string

jsonSerialize($includeEmptyKeys = false)

Parameters

Name Type Description
$includeEmptyKeys