Description uses Meta
A descriptor that updates all items in an ItemPriceCollection for MetaItemPrices to set a description based on the item's meta information
Table of Contents
Properties
| $date | |
| $factory | |
| $options |
Methods
| __construct() | Init |
| describe() | Sets a description on all items in the collection |
| getDescription() | Builds a description from the given meta data of an item |
| getMeta() | Retrieves all meta information set on a meta item combined together |
| getMetaFromCollection() | Retrieves all meta information set on an item collection |
| getFactory() | Creates a new instance of the DescriptionFactory |
| setDescriptions() | Updates all of the given MetaItems to set a description |
| updateMeta() | Updates the given MetaItemInterface to set the first meta item with the given data |
Properties
$date
private
Date
$date
An instance of the Date object
$factory
private
DescriptionFactory
$factory
An instance of the Description Factory
$options
private
array<string|int, mixed>
$options
An array of options used to construct the presenter
Methods
__construct()
Init
public
__construct(Date $date[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $date : Date
- $options : array<string|int, mixed> = []
describe()
Sets a description on all items in the collection
public
describe(ItemPriceCollection $collection) : ItemPriceCollection
Parameters
- $collection : ItemPriceCollection
Return values
ItemPriceCollection —The updated collection
getDescription()
Builds a description from the given meta data of an item
public
getDescription(array<string|int, mixed> $meta[, array<string|int, mixed> $oldMeta = null ]) : string
Parameters
- $meta : array<string|int, mixed>
-
An array of meta data representing the item
- $oldMeta : array<string|int, mixed> = null
-
An array of old meta data representing the item (optional, only used to combine the two sets of meta data into a single description)
Return values
string —The description
getMeta()
Retrieves all meta information set on a meta item combined together
protected
getMeta(MetaItemInterface $item) : array<string|int, mixed>
Parameters
- $item : MetaItemInterface
-
The item whose meta information to retrieve
Return values
array<string|int, mixed> —An array of all meta data
getMetaFromCollection()
Retrieves all meta information set on an item collection
protected
getMetaFromCollection(ItemCollection $collection) : array<string|int, mixed>
Parameters
- $collection : ItemCollection
-
An item collection
Return values
array<string|int, mixed> —An array of all meta data
getFactory()
Creates a new instance of the DescriptionFactory
private
getFactory() : DescriptionFactory
Return values
DescriptionFactorysetDescriptions()
Updates all of the given MetaItems to set a description
private
setDescriptions(array<string|int, mixed>|Iterator $items) : mixed
Parameters
- $items : array<string|int, mixed>|Iterator
-
A list of items that may be iterated over
updateMeta()
Updates the given MetaItemInterface to set the first meta item with the given data
private
updateMeta(MetaItemInterface $item, array<string|int, mixed> $meta) : MetaItemInterface
Parameters
- $item : MetaItemInterface
-
The item whose meta information to update
- $meta : array<string|int, mixed>
-
The meta information to update the item with
Return values
MetaItemInterface —The updated item