GoogleAnalyticsProductSerializer
in package
Class GoogleAnalyticsProductSerializer
Table of Contents
- encode() : string
- Encodes the given product value object into a json string.
- serialize() : array<string|int, mixed>
- Serializes the given product value object into an array.
- _tryToSet() : $this|GoogleAnalyticsProductSerializer
- Tries to set a new property, if the value is not null.
Methods
encode()
Encodes the given product value object into a json string.
public
encode(GoogleAnalyticsProductInterface $product, int $option) : string
Parameters
- $product : GoogleAnalyticsProductInterface
-
Product to be encoded.
- $option : int
-
Option flag, use a "JSON_" constant flag.
Return values
string —Json encoded product.
serialize()
Serializes the given product value object into an array.
public
serialize(GoogleAnalyticsProductInterface $product) : array<string|int, mixed>
Parameters
- $product : GoogleAnalyticsProductInterface
-
Product to be serialized.
Return values
array<string|int, mixed> —Serialized product.
_tryToSet()
Tries to set a new property, if the value is not null.
protected
_tryToSet(GoogleAnalyticsProductInterface $product, string $property, array<string|int, mixed> &$data) : $this|GoogleAnalyticsProductSerializer
Parameters
- $product : GoogleAnalyticsProductInterface
-
Product value object to be serialized.
- $property : string
-
Name of properties accessor method.
- $data : array<string|int, mixed>
-
Final serialized data array.
Return values
$this|GoogleAnalyticsProductSerializer —Same instance for chained method calls.