Asset
in package
Table of Contents
Properties
Methods
- __construct() : mixed
- Asset constructor.
- createFromArray() : Asset
- Creates an Asset object from an associative array of asset data.
- getMeta() : array<string|int, mixed>
- Get the Meta array of the asset.
- getMetaById() : mixed
- Get the Meta valut vy meta id.
- getMimeType() : string
- Get the MIME type of the asset.
- getName() : string
- Get the name of the asset file.
- getPimId() : int
- Get the PIM ID of the asset.
- getUrl() : string
- Get the URL to the asset.
- isImage() : bool
- Check if the asset is an image format.
- toArray() : array<string|int, mixed>
Properties
$meta
private
array<string|int, mixed>
$meta
The MIME type of the asset.
$mimeType
private
string
$mimeType
The MIME type of the asset.
$name
private
string
$name
The name of the asset file.
$pimId
private
int
$pimId
The PIM ID of the asset.
$url
private
string
$url
The URL to the asset.
Methods
__construct()
Asset constructor.
public
__construct(array<string|int, mixed> $meta, string $mimeType, string $name, string $url, int $pimId) : mixed
Initializes an Asset object with the given parameters.
Parameters
- $meta : array<string|int, mixed>
- $mimeType : string
-
The MIME type of the asset.
- $name : string
-
The name of the asset file.
- $url : string
-
The URL to the asset.
- $pimId : int
-
The PIM ID of the asset.
createFromArray()
Creates an Asset object from an associative array of asset data.
public
static createFromArray(array<string|int, mixed> $assetData) : Asset
This method takes an array containing asset information, such as mime type, name, URL, and PIM ID, and uses that data to instantiate a new Asset object. If any key is missing from the array, it defaults to an empty string.
Parameters
- $assetData : array<string|int, mixed>
-
The array containing asset information (mimeType, name, url, pimId).
Return values
Asset —A new Asset object populated with the provided data.
getMeta()
Get the Meta array of the asset.
public
getMeta() : array<string|int, mixed>
Return values
array<string|int, mixed> —The MIME type.
getMetaById()
Get the Meta valut vy meta id.
public
getMetaById(string $metaId) : mixed
Parameters
- $metaId : string
Return values
mixed —Value of asstes meta by index
getMimeType()
Get the MIME type of the asset.
public
getMimeType() : string
Return values
string —The MIME type.
getName()
Get the name of the asset file.
public
getName() : string
Return values
string —The name of the file.
getPimId()
Get the PIM ID of the asset.
public
getPimId() : int
Return values
int —The PIM ID.
getUrl()
Get the URL to the asset.
public
getUrl() : string
Return values
string —The URL.
isImage()
Check if the asset is an image format.
public
isImage() : bool
Return values
bool —True if the asset is an image format, false otherwise.
toArray()
public
toArray() : array<string|int, mixed>