AbstractItemComparator implements ItemComparatorInterface
AbstractYes
Abstract Item Comparator for MetaItemPrices
Attributes
- #[AllowDynamicProperties]
Table of Contents
Interfaces
| ItemComparatorInterface |
Properties
| $description_callback | |
| $price_callback |
Methods
| __construct() | Initializes a set of callbacks |
| setDescriptionCallback() | Sets the pricing callback that expects two arguments: |
| setPriceCallback() | Sets the pricing callback that expects four arguments: |
Methods
__construct()
Initializes a set of callbacks
public
__construct(callable $price_callback, callable $description_callback) : mixed
Parameters
- $price_callback : callable
-
The pricing callback that accepts four arguments for the old and new price, and the old and new ItemPrice meta data (each a Blesta\Items\Item\ItemCollection), and returns a float
- $description_callback : callable
-
The description callback that accepts two arguments for the old and new ItemPrice meta data (each a Blesta\Items\Item\ItemCollection or null), and returns a string
setDescriptionCallback()
Sets the pricing callback that expects two arguments:
public
setDescriptionCallback(callable $callback) : mixed
- a Blesta\Items\Collection\ItemCollection of the old ItemPrice meta data, or null
- a Blesta\Items\Collection\ItemCollection of the new ItemPrice meta data, or null and returns a string representing a description.
Parameters
- $callback : callable
-
The callback
setPriceCallback()
Sets the pricing callback that expects four arguments:
public
setPriceCallback(callable $callback) : mixed
- the old price as a float
- the new price as a float
- a Blesta\Items\Collection\ItemCollection of the old ItemPrice meta data, or null
- a Blesta\Items\Collection\ItemCollection of the new ItemPrice meta data, or null and returns a float value representing a price.
Parameters
- $callback : callable
-
The callback