eZ\Publish\Core\REST\Common\Output\Generator\Json\FieldTypeHashGenerator::generateValue PHP Method

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
    protected function generateValue($parent, $value)
    {
        switch ($hashValueType = gettype($value)) {
            case 'NULL':
            case 'boolean':
            case 'integer':
            case 'double':
            case 'string':
                // Will be handled accordingly on serialization
                return $value;
                break;
            case 'array':
                return $this->generateArrayValue($parent, $value);
                break;
            default:
                throw new \Exception('Invalid type in field value hash: ' . $hashValueType);
        }
    }