PHP Class eZ\Publish\Core\REST\Common\Output\Generator\Json\FieldTypeHashGenerator

Show file Open project: ezsystems/ezpublish-kernel Class Usage Examples

Public Methods

Method Description
generateHashValue ( ArrayObject | Object $parent, string $hashElementName, mixed $hashValue ) Generates the field type value $hashValue as a child of the given Object using $hashElementName as the property name.

Protected Methods

Method Description
generateArrayValue ( ArrayObject | Object $parent, array $value ) : ArrayObject | Object Generates and returns a JSON structure (array or object) depending on $value type with $parent.
generateHashArray ( ArrayObject | Object $parent, array $hashArray ) : Object Generates a JSON object from the given $hashArray with $parent.
generateListArray ( ArrayObject | Object $parent, array $listArray ) : ArrayObject Generates a JSON array from the given $hashArray with $parent.
generateValue ( ArrayObject | Object $parent, mixed $value ) : mixed Generates and returns a value based on $hashValue type, with $parent ( if the type of $hashValue supports it).
isNumericArray ( array $value ) : boolean Checks if the given $value is a purely numeric array.

Method Details

generateArrayValue() protected method

If $type only contains numeric keys, the resulting structure will be an JSON array, otherwise a JSON object
protected generateArrayValue ( ArrayObject | Object $parent, array $value ) : ArrayObject | Object
$parent ArrayObject | Object
$value array
return ArrayObject | Object

generateHashArray() protected method

Generates a JSON object from the given $hashArray with $parent.
protected generateHashArray ( ArrayObject | Object $parent, array $hashArray ) : Object
$parent ArrayObject | Object
$hashArray array
return Object

generateHashValue() public method

Generates the field type value $hashValue as a child of the given Object using $hashElementName as the property name.
public generateHashValue ( ArrayObject | Object $parent, string $hashElementName, mixed $hashValue )
$parent ArrayObject | Object
$hashElementName string
$hashValue mixed

generateListArray() protected method

Generates a JSON array from the given $hashArray with $parent.
protected generateListArray ( ArrayObject | Object $parent, array $listArray ) : ArrayObject
$parent ArrayObject | Object
$listArray array
return ArrayObject

generateValue() protected method

Generates and returns a value based on $hashValue type, with $parent ( if the type of $hashValue supports it).
protected generateValue ( ArrayObject | Object $parent, mixed $value ) : mixed
$parent ArrayObject | Object
$value mixed
return mixed

isNumericArray() protected method

Checks if the given $value is a purely numeric array.
protected isNumericArray ( array $value ) : boolean
$value array
return boolean