ProductCommentCollection extends ElementCollection
in package
Uses ElementTrait

This is the product comment collection class.

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

Tags
see
ProductCommentCollection::getRating()
see
ElementCollection
see
ElementTrait

Table of Contents

$error  : Error|null
$filter  : Filter|null
$index  : int
$items  : array<string|int, mixed>
$pagination  : Pagination|null
__construct() Elements constructor.  : mixed
__toString() Uses "json_encode" function to return the JSON format of the element.  : string
count() Added to comply the \Countable interface.  : int
current() Added to comply the \Iterator interface.  : mixed
getError() Returns the current element error (if there is error).  : Error|null
getFilter() Returns the filter object of this collection.  : Filter
getItems() Returns the elements on the collection.  : array<string|int, Element>
getPagination() Returns the pagination object of this collection.  : Pagination
getRating() Returns the average rating of the comments on this collection.  : float
jsonSerialize() Allow elements to be serialized.  : array<string|int, mixed>
key() Added to comply the \Iterator interface.  : int
next() Added to comply the \Iterator interface.  : void
reverse() Reverse the order of the collection.  : void
rewind() Added to comply the \Iterator interface.  : void
toArray() Used to allow elements to be serialized.  : array<string|int, mixed>
valid() Added to comply the \Iterator interface.  : bool
getFieldItem()  : object|null
getFormattedData()  : mixed
setArrayField() Convert an API array of objects to a PHP array of objects.  : array<string|int, mixed>
setError()  : void
setFilter()  : void
setPagination()  : 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

count()

Added to comply the \Countable interface.

public count() : int

Returns the number of elements on the collection.

Return values
int

current()

Added to comply the \Iterator interface.

public current() : mixed

Returns the current element on the iteration.

Return values
mixed

getError()

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

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

getRating()

Returns the average rating of the comments on this collection.

public getRating() : float
Return values
float

jsonSerialize()

Allow elements to be serialized.

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

Auto-invoked using "json_encode" function.

Return values
array<string|int, mixed>

key()

Added to comply the \Iterator interface.

public key() : int

Returns the current key on the iteration.

Return values
int

next()

Added to comply the \Iterator interface.

public next() : void

Moves the cursor one element forward.

Return values
void

reverse()

Reverse the order of the collection.

public reverse() : void
Return values
void

rewind()

Added to comply the \Iterator interface.

public rewind() : void

Moves the cursor to the beggining.

Return values
void

toArray()

Used to allow elements to be serialized.

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

valid()

Added to comply the \Iterator interface.

public valid() : bool

Returns if the current element on the iteration is defined.

Return values
bool

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

setFilter()

protected setFilter(array<string|int, mixed> $filter) : void
Parameters
$filter : array<string|int, mixed>
Return values
void

setPagination()

protected setPagination(array<string|int, mixed> $pagination) : void
Parameters
$pagination : array<string|int, mixed>
Return values
void

Search results