Output generator.
Constants
|
protected mixed NULL_PARENT_ELEMENT_EXCEPTION_MESSAGE = 'Parent element at %s cannot be `null`.'
|
Properties
Generator for field type hash values.
|
protected AbstractFieldTypeHashGenerator $fieldTypeHashGenerator
|
If set to true, output will be formatted and indented.
|
protected bool $formatOutput = false
|
Keeps track if the document is still empty.
|
protected bool $isEmpty = true
|
Data structure which is build during visiting.
|
protected DataObjectInterface $json
|
|
protected array<string|int, array{: string, : mixed, : array}> $stack = []
|
Methods
|
public __construct(string $vendor)
|
Parameters
Name |
Type |
Default value |
Description |
$vendor
|
string
|
-
|
-
|
Generate attribute with given $name and $value.
|
public attribute(string $name, mixed $value) : void
|
Parameters
Name |
Type |
Default value |
Description |
$name
|
string
|
-
|
-
|
$value
|
mixed
|
-
|
-
|
End attribute.
|
public endAttribute(string $name) : void
|
Parameters
Name |
Type |
Default value |
Description |
$name
|
string
|
-
|
-
|
End document.
|
public abstract endDocument(mixed $data) : string
|
Parameters
Name |
Type |
Default value |
Description |
$data
|
mixed
|
-
|
-
|
Return values
string
End hash element.
|
public endHashElement(string $name) : void
|
Parameters
Name |
Type |
Default value |
Description |
$name
|
string
|
-
|
-
|
End list.
|
public endList(string $name) : void
|
Parameters
Name |
Type |
Default value |
Description |
$name
|
string
|
-
|
-
|
|
public endObjectElement(string|int $name) : void
|
Parameters
Name |
Type |
Default value |
Description |
$name
|
string|int
|
-
|
-
|
End value element.
|
public endValueElement(string $name) : void
|
Parameters
Name |
Type |
Default value |
Description |
$name
|
string
|
-
|
-
|
Generates a generic representation of the scalar, hash or list given in
$hashValue into the document, using an element of $hashElementName as
its parent.
|
public generateFieldTypeHash(string $hashElementName, mixed $hashValue) : void
|
Parameters
Name |
Type |
Default value |
Description |
$hashElementName
|
string
|
-
|
-
|
$hashValue
|
mixed
|
-
|
-
|
|
public abstract getEncoderContext(array<string|int, mixed> $data) : array<string|int, mixed>
|
Parameters
Name |
Type |
Default value |
Description |
$data
|
array<string|int, mixed>
|
-
|
-
|
Return values
array<string|int, mixed>
Get media type.
|
public abstract getMediaType(string $name) : string
|
Parameters
Name |
Type |
Default value |
Description |
$name
|
string
|
-
|
-
|
Return values
string
Returns if the document is empty or already contains data.
Return values
bool
Reset output visitor to a virgin state.
Serializes a boolean value.
|
public abstract serializeBool(bool|string|null $boolValue) : bool|string
|
Parameters
Name |
Type |
Default value |
Description |
$boolValue
|
bool|string|null
|
-
|
-
|
Return values
bool|string
|
public setFormatOutput(bool $formatOutput) : void
|
Parameters
Name |
Type |
Default value |
Description |
$formatOutput
|
bool
|
-
|
-
|
Start attribute.
|
public abstract startAttribute(string $name, mixed $value) : void
|
Parameters
Name |
Type |
Default value |
Description |
$name
|
string
|
-
|
-
|
$value
|
mixed
|
-
|
-
|
Start document.
|
public startDocument(mixed $data) : void
|
Parameters
Name |
Type |
Default value |
Description |
$data
|
mixed
|
-
|
-
|
Start hash element.
|
public startHashElement(string $name) : void
|
Parameters
Name |
Type |
Default value |
Description |
$name
|
string
|
-
|
-
|
Start list.
|
public abstract startList(string $name) : void
|
Parameters
Name |
Type |
Default value |
Description |
$name
|
string
|
-
|
-
|
Start object element.
|
public startObjectElement(string|int $name[, string|null $mediaTypeName = null ]) : void
|
Parameters
Name |
Type |
Default value |
Description |
$name
|
string|int
|
-
|
-
|
$mediaTypeName
|
string|null
|
null
|
-
|
|
public abstract startValueElement(string $name, mixed $value[, array<string|int, mixed> $attributes = [] ]) : void
|
Parameters
Name |
Type |
Default value |
Description |
$name
|
string
|
-
|
-
|
$value
|
mixed
|
-
|
-
|
$attributes
|
array<string|int, mixed>
|
[]
|
-
|
Generate value element with given $name and $value.
|
public valueElement(string $name, mixed $value) : void
|
Parameters
Name |
Type |
Default value |
Description |
$name
|
string
|
-
|
-
|
$value
|
mixed
|
-
|
-
|
Check close / end operation.
|
protected checkEnd(string $type, mixed $data) : void
|
Parameters
Name |
Type |
Default value |
Description |
$type
|
string
|
-
|
-
|
$data
|
mixed
|
-
|
-
|
Check end attribute.
|
protected checkEndAttribute(mixed $data) : void
|
Parameters
Name |
Type |
Default value |
Description |
$data
|
mixed
|
-
|
-
|
Check end document.
|
protected checkEndDocument(mixed $data) : void
|
Parameters
Name |
Type |
Default value |
Description |
$data
|
mixed
|
-
|
-
|
Check end hash element.
|
protected checkEndHashElement(mixed $data) : void
|
Parameters
Name |
Type |
Default value |
Description |
$data
|
mixed
|
-
|
-
|
Check end list.
|
protected checkEndList(mixed $data) : void
|
Parameters
Name |
Type |
Default value |
Description |
$data
|
mixed
|
-
|
-
|
Check end object element.
|
protected checkEndObjectElement(mixed $data) : void
|
Parameters
Name |
Type |
Default value |
Description |
$data
|
mixed
|
-
|
-
|
Check end value element.
|
protected checkEndValueElement(mixed $data) : void
|
Parameters
Name |
Type |
Default value |
Description |
$data
|
mixed
|
-
|
-
|
|
protected checkStack(mixed $data) : void
|
Parameters
Name |
Type |
Default value |
Description |
$data
|
mixed
|
-
|
-
|
Check close / end operation.
|
protected checkStart(string $type, mixed $data, array<string|int, string> $validParents) : void
|
Parameters
Name |
Type |
Default value |
Description |
$type
|
string
|
-
|
-
|
$data
|
mixed
|
-
|
-
|
$validParents
|
array<string|int, string>
|
-
|
-
|
Check start attribute.
|
protected checkStartAttribute(mixed $data) : void
|
Parameters
Name |
Type |
Default value |
Description |
$data
|
mixed
|
-
|
-
|
Check start document.
|
protected checkStartDocument(mixed $data) : void
|
Parameters
Name |
Type |
Default value |
Description |
$data
|
mixed
|
-
|
-
|
Check start hash element.
|
protected checkStartHashElement(mixed $data) : void
|
Parameters
Name |
Type |
Default value |
Description |
$data
|
mixed
|
-
|
-
|
Check start list.
|
protected checkStartList(mixed $data) : void
|
Parameters
Name |
Type |
Default value |
Description |
$data
|
mixed
|
-
|
-
|
|
protected checkStartObjectElement(mixed $data) : void
|
Parameters
Name |
Type |
Default value |
Description |
$data
|
mixed
|
-
|
-
|
Check start value element.
|
protected checkStartValueElement(mixed $data) : void
|
Parameters
Name |
Type |
Default value |
Description |
$data
|
mixed
|
-
|
-
|
Generates a media type from $name, $type and $vendor.
|
protected generateMediaTypeWithVendor(string $name, string $type[, string $vendor = 'vnd.ibexa.api' ]) : string
|
Parameters
Name |
Type |
Default value |
Description |
$name
|
string
|
-
|
-
|
$type
|
string
|
-
|
-
|
$vendor
|
string
|
'vnd.ibexa.api'
|
-
|
Return values
string
|
protected abstract getData() : DataObjectInterface
|
Return values
DataObjectInterface
|
protected getVendor() : string
|
Return values
string