Basket extends Element
in package
Uses ElementTrait

This is the basket class.

The basket information will be stored in that class and will remain immutable (only get methods are available)

Tags
see
Basket::getToken()
see
Basket::getItems()
see
Basket::getItem()
see
Basket::getBasketUser()
see
Basket::getCreatedAt()
see
Basket::getUpdatedAt()
see
Basket::getDelivery()
see
Basket::getPaymentSystem()
see
Basket::getVouchers()
see
Basket::getTaxes()
see
Basket::getTotals()
see
Basket::getAppliedDiscounts()
see
Basket::getComment()
see
Basket::getBasketWarnings()
see
Basket::getAllBasketWarnings()
see
Basket::getItemsBasketWarnings()
see
Basket::getItemBasketWarnings()
see
Basket::getDeliveryBasketWarnings()
see
Basket::getDeliveryItemBasketWarnings()
see
Basket::getCustomTagValues()
see
Basket::getRewardPoints()
see
Element
see
ElementTrait

Table of Contents

$error  : Error|null
__construct() Elements constructor.  : mixed
__toString() Uses "json_encode" function to return the JSON format of the element.  : string
getAllBasketWarnings() Returns all the warnings inside the basket structure (main basket warnings, rows warnings and deliveries warnings).  : array<string|int, BasketWarning>
getAppliedDiscounts() Returns the basket applied discounts.  : array<string|int, AppliedDiscount>
getBasketUser() Returns the basket user.  : BasketUser
getBasketWarnings() Returns the basket warnings.  : array<string|int, BasketWarning>
getComment() Returns the basket comments.  : string
getCreatedAt() Returns the basket creation date.  : Date|null
getCustomTagValues() Returns the basket custom tag values.  : array<string|int, BasketCustomTagValue>
getDelivery() Returns the basket delivery.  : Delivery|null
getDeliveryBasketWarnings() Returns all the warnings inside the delivery warnings array.  : array<string|int, BasketWarning>
getDeliveryItemBasketWarnings() Returns all the warnings inside the delivery warnings array for the item with the given hash.  : array<string|int, BasketWarning>
getError() Returns the current element error (if there is error).  : Error|null
getItem() Returns the item with the given hash.  : BasketRow|null
getItemBasketWarnings() Returns all the warnings that belongs to the item with the given hash.  : array<string|int, BasketWarning>
getItems() Returns the basket items.  : array<string|int, BasketRow>
getItemsBasketWarnings() Returns all the warnings inside the basket items array.  : array<string|int, BasketWarning>
getPaymentSystem() Returns the basket setted payment system.  : PaymentSystem|null
getRewardPoints() Returns the basket reward ooints values.  : array<string|int, BasketRewardPoints>
getTaxes() Returns the basket taxes.  : array<string|int, BasketTax>
getToken() Returns the basket token.  : string
getTotals() Returns the basket total.  : BasketTotal|null
getUpdatedAt() Returns the basket last update date.  : Date|null
getVouchers() Returns the basket voucher group.  : VoucherGroup|null
jsonSerialize() Allow elements to be serialized.  : array<string|int, mixed>
toArray() Used to allow elements to be serialized.  : array<string|int, mixed>
getFieldItem()  : object|null
getFormattedData()  : mixed
setArrayField() Convert an API array of objects to a PHP array of objects.  : array<string|int, mixed>
setError()  : void

Properties

Methods

__construct()

Elements constructor.

public __construct([array<string|int, mixed> $data = [] ]) : mixed
Parameters
$data : array<string|int, mixed> = []

Array that contains all the values to the object to initialize

Return values
mixed

__toString()

Uses "json_encode" function to return the JSON format of the element.

public __toString() : string

Auto-invoked using echo or concatenations.

Return values
string

getAllBasketWarnings()

Returns all the warnings inside the basket structure (main basket warnings, rows warnings and deliveries warnings).

public getAllBasketWarnings() : array<string|int, BasketWarning>
Return values
array<string|int, BasketWarning>

getBasketWarnings()

Returns the basket warnings.

public getBasketWarnings() : array<string|int, BasketWarning>
Return values
array<string|int, BasketWarning>

getComment()

Returns the basket comments.

public getComment() : string
Return values
string

getCreatedAt()

Returns the basket creation date.

public getCreatedAt() : Date|null
Return values
Date|null

getDelivery()

Returns the basket delivery.

public getDelivery() : Delivery|null
Return values
Delivery|null

getDeliveryBasketWarnings()

Returns all the warnings inside the delivery warnings array.

public getDeliveryBasketWarnings() : array<string|int, BasketWarning>
Return values
array<string|int, BasketWarning>

getDeliveryItemBasketWarnings()

Returns all the warnings inside the delivery warnings array for the item with the given hash.

public getDeliveryItemBasketWarnings(string $hash) : array<string|int, BasketWarning>
Parameters
$hash : string
Return values
array<string|int, BasketWarning>

getError()

Returns the current element error (if there is error).

public getError() : Error|null
Return values
Error|null

getItem()

Returns the item with the given hash.

public getItem(string $hash) : BasketRow|null
Parameters
$hash : string
Return values
BasketRow|null

getItemBasketWarnings()

Returns all the warnings that belongs to the item with the given hash.

public getItemBasketWarnings(string $hash) : array<string|int, BasketWarning>
Parameters
$hash : string
Return values
array<string|int, BasketWarning>

getItems()

Returns the basket items.

public getItems() : array<string|int, BasketRow>
Return values
array<string|int, BasketRow>

getItemsBasketWarnings()

Returns all the warnings inside the basket items array.

public getItemsBasketWarnings() : array<string|int, BasketWarning>
Return values
array<string|int, BasketWarning>

getTaxes()

Returns the basket taxes.

public getTaxes() : array<string|int, BasketTax>
Return values
array<string|int, BasketTax>

getToken()

Returns the basket token.

public getToken() : string
Return values
string

getUpdatedAt()

Returns the basket last update date.

public getUpdatedAt() : Date|null
Return values
Date|null

jsonSerialize()

Allow elements to be serialized.

public jsonSerialize() : array<string|int, mixed>

Auto-invoked using "json_encode" function.

Return values
array<string|int, mixed>

toArray()

Used to allow elements to be serialized.

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

getFieldItem()

protected getFieldItem(array<string|int, mixed> $item, string $class) : object|null
Parameters
$item : array<string|int, mixed>
$class : string
Return values
object|null

getFormattedData()

protected getFormattedData(mixed $value) : mixed
Parameters
$value : mixed
Return values
mixed

setArrayField()

Convert an API array of objects to a PHP array of objects.

protected setArrayField(array<string|int, mixed> $data, string $class) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed>

Array that contains all the values to the objects to initialize

$class : string

The PHP class we want the objects to be

Return values
array<string|int, mixed>

setError()

protected setError(mixed $error) : void
Parameters
$error : mixed
Return values
void

Search results