WithdrawalJsonSerializer
extends AbstractJsonSerializer
in package
Class WithdrawalJsonSerializer
This class will serialize and deserialize a Withdrawal entity. It can be used into many places where PHP interacts with external requests such as AJAX or API communications.
Tags
Table of Contents
- $languageProvider : LanguageProviderInterface
- Used for the resources that require multiple languages.
- $withdrawalWriteService : WithdrawalWriteServiceInterface
- Withdrawals write service.
- __construct() : mixed
- WithdrawalJsonSerializer constructor.
- deserialize() : WithdrawalInterface
- Deserialize a Product JSON String.
- jsonEncode() : string
- JSON Encode Wrapper
- serialize() : string|array<string|int, mixed>
- Serialize a Withdrawal object to a JSON string.
- serializeWithdrawalCollection() : string|array<string|int, mixed>
- Serializes withdrawal collections.
- _deserializeAddonValues() : array<string|int, mixed>
- Deserialize Addon Values
- _deserializeLanguageSpecificProperty() : mixed
- Deserialize Language Specific Property
- _deserializeWithdrawalOrder() : WithdrawalOrderInterface
- Deserialize withdrawal order entities.
- _mapGender() : string
- Maps provided gender to a valid value for the new withdrawals domain used in the API v3.
- _serializeAddonValues() : array<string|int, mixed>
- Serialize Addon Values
- _serializeLanguageSpecificProperty() : array<string|int, mixed>
- Serialize Language Specific Property
- _serializeWithdrawalOrder() : array<string|int, mixed>
- Serializes withdrawal order entities.
Properties
$languageProvider
Used for the resources that require multiple languages.
protected
LanguageProviderInterface
$languageProvider
$withdrawalWriteService
Withdrawals write service.
protected
WithdrawalWriteServiceInterface
$withdrawalWriteService
Methods
__construct()
WithdrawalJsonSerializer constructor.
public
__construct(WithdrawalWriteServiceInterface $withdrawalWriteService) : mixed
Parameters
- $withdrawalWriteService : WithdrawalWriteServiceInterface
Return values
mixed —deserialize()
Deserialize a Product JSON String.
public
deserialize(string $string[, WithdrawalInterface $baseObject = null ]) : WithdrawalInterface
Parameters
- $string : string
-
JSON string that contains the data of the slider.
- $baseObject : WithdrawalInterface = null
-
(optional) If provided, this will be the base object to be updated and no new instance will be created.
Tags
Return values
WithdrawalInterface —jsonEncode()
JSON Encode Wrapper
public
jsonEncode(array<string|int, mixed> $data) : string
This function provides PHP v5.3 compatibility and it should be used when serialized objects need to be encoded directly from the serializer instance.
Parameters
- $data : array<string|int, mixed>
-
Contains the data to be JSON encoded.
Return values
string —Returns the encoded JSON string that represents the data.
serialize()
Serialize a Withdrawal object to a JSON string.
public
serialize(WithdrawalInterface $object[, bool $encode = true ]) : string|array<string|int, mixed>
Parameters
- $object : WithdrawalInterface
-
Object instance to be serialized.
- $encode : bool = true
-
(optional) Whether to json_encode the result of the method (default true).
Tags
Return values
string|array<string|int, mixed> —Returns the json encoded withdrawal (string) or an array that can be easily encoded into a JSON string.
serializeWithdrawalCollection()
Serializes withdrawal collections.
public
serializeWithdrawalCollection(WithdrawalCollection $withdrawalCollection[, bool $encode = true ]) : string|array<string|int, mixed>
Parameters
- $withdrawalCollection : WithdrawalCollection
-
Withdrawal collection to be serialized.
- $encode : bool = true
-
(optional) Whether to json_encode the result of the method (default true).
Return values
string|array<string|int, mixed> —Returns the json encoded withdrawal collection(string) or an array that can be easily encoded into a JSON string.
_deserializeAddonValues()
Deserialize Addon Values
protected
_deserializeAddonValues( $json) : array<string|int, mixed>
Common method for deserializing addon values in various resource serializer classes.
Parameters
Return values
array<string|int, mixed> —_deserializeLanguageSpecificProperty()
Deserialize Language Specific Property
protected
_deserializeLanguageSpecificProperty(mixed $object, stdobject $json, string $property[, mixed $type = 'StringType' ]) : mixed
This method will deserialize the value of a JSON property and set the value to the object by using the corresponding setter method.
Parameters
- $object : mixed
-
The object being deserialized.
- $json : stdobject
-
The JSON object containing the property value.
- $property : string
-
The property name to be deserialized.
- $type : mixed = 'StringType'
Tags
Return values
mixed —_deserializeWithdrawalOrder()
Deserialize withdrawal order entities.
protected
_deserializeWithdrawalOrder(stdClass $withdrawalOrderData) : WithdrawalOrderInterface
Parameters
- $withdrawalOrderData : stdClass
-
withdrawal order entity.
Return values
WithdrawalOrderInterface —Deserialize withdrawal order entity.
_mapGender()
Maps provided gender to a valid value for the new withdrawals domain used in the API v3.
protected
_mapGender(string $gender) : string
Parameters
- $gender : string
Return values
string —_serializeAddonValues()
Serialize Addon Values
protected
_serializeAddonValues(KeyValueCollection $addonValues) : array<string|int, mixed>
Common method for serializing addon values in various resource serializer classes.
Parameters
- $addonValues : KeyValueCollection
Return values
array<string|int, mixed> —_serializeLanguageSpecificProperty()
Serialize Language Specific Property
protected
_serializeLanguageSpecificProperty(mixed $object, string $property) : array<string|int, mixed>
In order for this method to work there has to be a proper getter method in the object instance. Otherwise a RuntimeException will be thrown.
Parameters
- $object : mixed
-
The object instance containing the property.
- $property : string
-
The property name to be serialized.
Tags
Return values
array<string|int, mixed> —_serializeWithdrawalOrder()
Serializes withdrawal order entities.
protected
_serializeWithdrawalOrder(WithdrawalOrderInterface $withdrawalOrder) : array<string|int, mixed>
Parameters
- $withdrawalOrder : WithdrawalOrderInterface
-
withdrawal order entity to be serialized.
Return values
array<string|int, mixed> —Serialized withdrawal order array.