Attribute
in package
Table of Contents
Properties
Methods
- __construct() : mixed
- Attribute constructor.
- getGroup() : array<string|int, mixed>
- Get the group metadata of the attribute.
- getGroupId() : string
- Get the ID of the group that the attribute belongs to.
- getGroupName() : string
- Get the name of the group that the attribute belongs to.
- getGroupPosition() : int
- Get the position of the group that the attribute belongs to.
- getHelpText() : string
- Get the name of the attribute from the metadata.
- getId() : string
- Get the attribute ID.
- getMeta() : array<string|int, mixed>
- Get the metadata of the attribute.
- getName() : string
- Get the name of the attribute from the metadata.
- getNonEmptyValue() : array<string|int, mixed>|string|bool|null
- Get the non-empty value of the attribute.
- getPimId() : string
- Get the PIM (Product Information Management) ID of the attribute.
- getPositionInGroup() : int
- Get the position of the attribute within its group.
- getTags() : array<string|int, mixed>
- Get the tags associated with the attribute.
- getValue() : array<string|int, mixed>|string|bool|null
- Get the value of the attribute.
- hasTag() : bool
- Check if the attribute contains a specific tag or all from array of tags.
Properties
$id
private
string
$id
The unique identifier of the attribute.
$meta
private
array<string|int, mixed>
$meta
Metadata associated with the attribute.
$value
private
array<string|int, mixed>|string
$value
The value(s) of the attribute. Can be a single string or an array of strings.
Methods
__construct()
Attribute constructor.
public
__construct(string $id, array<string|int, mixed> $meta, array<string|int, mixed>|string $value) : mixed
Initializes an Attribute object with the given parameters.
Parameters
- $id : string
-
The unique identifier for the attribute.
- $meta : array<string|int, mixed>
-
Metadata for the attribute.
- $value : array<string|int, mixed>|string
-
The value(s) of the attribute.
getGroup()
Get the group metadata of the attribute.
public
getGroup() : array<string|int, mixed>
Return values
array<string|int, mixed> —The group metadata.
getGroupId()
Get the ID of the group that the attribute belongs to.
public
getGroupId() : string
Return values
string —The group ID.
getGroupName()
Get the name of the group that the attribute belongs to.
public
getGroupName() : string
Return values
string —The name of the group.
getGroupPosition()
Get the position of the group that the attribute belongs to.
public
getGroupPosition() : int
Return values
int —The position of the group.
getHelpText()
Get the name of the attribute from the metadata.
public
getHelpText() : string
Return values
string —The name of the attribute.
getId()
Get the attribute ID.
public
getId() : string
Return values
string —The unique identifier of the attribute.
getMeta()
Get the metadata of the attribute.
public
getMeta() : array<string|int, mixed>
Return values
array<string|int, mixed> —The metadata associated with the attribute.
getName()
Get the name of the attribute from the metadata.
public
getName() : string
Return values
string —The name of the attribute.
getNonEmptyValue()
Get the non-empty value of the attribute.
public
getNonEmptyValue() : array<string|int, mixed>|string|bool|null
Return values
array<string|int, mixed>|string|bool|null —The value of the attribute or null if empty or any of the specified strings.
getPimId()
Get the PIM (Product Information Management) ID of the attribute.
public
getPimId() : string
Return values
string —The PIM ID of the attribute.
getPositionInGroup()
Get the position of the attribute within its group.
public
getPositionInGroup() : int
Return values
int —The position of the attribute in the group.
getTags()
Get the tags associated with the attribute.
public
getTags() : array<string|int, mixed>
Return values
array<string|int, mixed> —The tags associated with the attribute.
getValue()
Get the value of the attribute.
public
getValue() : array<string|int, mixed>|string|bool|null
If there is only one value, return it as a string. If there are multiple values, return the array. Returns false if the value is empty.
Return values
array<string|int, mixed>|string|bool|null —The value of the attribute or null if empty.
hasTag()
Check if the attribute contains a specific tag or all from array of tags.
public
hasTag(string|array<string|int, mixed> $tag) : bool
This function checks whether a given string (tag) or array of tags exists in the list of tags associated with this attribute.
Parameters
- $tag : string|array<string|int, mixed>
-
The tag/tags to check.
Return values
bool —True if the tag/tags are present, false otherwise.