Copied!

Generator

Generator.php : 18
Abstract

Output generator.

Constants

protectedNULL_PARENT_ELEMENT_EXCEPTION_MESSAGE

Generator.php : 20
protected mixed NULL_PARENT_ELEMENT_EXCEPTION_MESSAGE = 'Parent element at %s cannot be `null`.'

Properties

protected $fieldTypeHashGenerator

Generator.php : 49

Generator for field type hash values.

protected AbstractFieldTypeHashGenerator $fieldTypeHashGenerator

protected $formatOutput

Generator.php : 39

If set to true, output will be formatted and indented.

protected bool $formatOutput = false

protected $isEmpty

Generator.php : 25

Keeps track if the document is still empty.

protected bool $isEmpty = true

protected $json

Generator.php : 54

Data structure which is build during visiting.

protected DataObjectInterface $json

protected $stack

Generator.php : 34
protected array<string|int, array{: string, : mixed, : array}> $stack = []

Methods

public__construct()

Generator.php : 56
public __construct(string $vendor)

Parameters

Name Type Default value Description
$vendor string - -

publicattribute()

Generator.php : 303

Generate attribute with given $name and $value.

public attribute(string $name, mixed $value) : void

Parameters

Name Type Default value Description
$name string - -
$value mixed - -

publicendAttribute()

Generator.php : 325

End attribute.

public endAttribute(string $name) : void

Parameters

Name Type Default value Description
$name string - -

publicendDocument()

Generator.php : 117

End document.

public abstract endDocument(mixed $data) : string

Parameters

Name Type Default value Description
$data mixed - -

Return values

string

publicendHashElement()

Generator.php : 201

End hash element.

public endHashElement(string $name) : void

Parameters

Name Type Default value Description
$name string - -

publicendList()

Generator.php : 278

End list.

public endList(string $name) : void

Parameters

Name Type Default value Description
$name string - -

publicendObjectElement()

Generator.php : 145
public endObjectElement(string|int $name) : void

Parameters

Name Type Default value Description
$name string|int - -

publicendValueElement()

Generator.php : 249

End value element.

public endValueElement(string $name) : void

Parameters

Name Type Default value Description
$name string - -

publicgenerateFieldTypeHash()

Generator.php : 359

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 - -

publicgetEncoderContext()

Generator.php : 439
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>

publicgetMediaType()

Generator.php : 341

Get media type.

public abstract getMediaType(string $name) : string

Parameters

Name Type Default value Description
$name string - -

Return values

string

publicisEmpty()

Generator.php : 69

Returns if the document is empty or already contains data.

public isEmpty() : bool

Return values

bool

publicreset()

Generator.php : 82

Reset output visitor to a virgin state.

public reset() : void

publicserializeBool()

Generator.php : 430

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

publicsetFormatOutput()

Generator.php : 61
public setFormatOutput(bool $formatOutput) : void

Parameters

Name Type Default value Description
$formatOutput bool - -

publicstartAttribute()

Generator.php : 312

Start attribute.

public abstract startAttribute(string $name, mixed $value) : void

Parameters

Name Type Default value Description
$name string - -
$value mixed - -

publicstartDocument()

Generator.php : 91

Start document.

public startDocument(mixed $data) : void

Parameters

Name Type Default value Description
$data mixed - -

publicstartHashElement()

Generator.php : 179

Start hash element.

public startHashElement(string $name) : void

Parameters

Name Type Default value Description
$name string - -

publicstartList()

Generator.php : 265

Start list.

public abstract startList(string $name) : void

Parameters

Name Type Default value Description
$name string - -

publicstartObjectElement()

Generator.php : 130

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 -

publicstartValueElement()

Generator.php : 236
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> [] -

publicvalueElement()

Generator.php : 226

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 - -

protectedcheckEnd()

Generator.php : 402

Check close / end operation.

protected checkEnd(string $type, mixed $data) : void

Parameters

Name Type Default value Description
$type string - -
$data mixed - -

protectedcheckEndAttribute()

Generator.php : 333

Check end attribute.

protected checkEndAttribute(mixed $data) : void

Parameters

Name Type Default value Description
$data mixed - -

protectedcheckEndDocument()

Generator.php : 122

Check end document.

protected checkEndDocument(mixed $data) : void

Parameters

Name Type Default value Description
$data mixed - -

protectedcheckEndHashElement()

Generator.php : 218

Check end hash element.

protected checkEndHashElement(mixed $data) : void

Parameters

Name Type Default value Description
$data mixed - -

protectedcheckEndList()

Generator.php : 295

Check end list.

protected checkEndList(mixed $data) : void

Parameters

Name Type Default value Description
$data mixed - -

protectedcheckEndObjectElement()

Generator.php : 171

Check end object element.

protected checkEndObjectElement(mixed $data) : void

Parameters

Name Type Default value Description
$data mixed - -

protectedcheckEndValueElement()

Generator.php : 257

Check end value element.

protected checkEndValueElement(mixed $data) : void

Parameters

Name Type Default value Description
$data mixed - -

protectedcheckStack()

Generator.php : 457
protected checkStack(mixed $data) : void

Parameters

Name Type Default value Description
$data mixed - -

protectedcheckStart()

Generator.php : 373

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> - -

protectedcheckStartAttribute()

Generator.php : 317

Check start attribute.

protected checkStartAttribute(mixed $data) : void

Parameters

Name Type Default value Description
$data mixed - -

protectedcheckStartDocument()

Generator.php : 103

Check start document.

protected checkStartDocument(mixed $data) : void

Parameters

Name Type Default value Description
$data mixed - -

protectedcheckStartHashElement()

Generator.php : 191

Check start hash element.

protected checkStartHashElement(mixed $data) : void

Parameters

Name Type Default value Description
$data mixed - -

protectedcheckStartList()

Generator.php : 270

Check start list.

protected checkStartList(mixed $data) : void

Parameters

Name Type Default value Description
$data mixed - -

protectedcheckStartObjectElement()

Generator.php : 161
protected checkStartObjectElement(mixed $data) : void

Parameters

Name Type Default value Description
$data mixed - -

protectedcheckStartValueElement()

Generator.php : 241

Check start value element.

protected checkStartValueElement(mixed $data) : void

Parameters

Name Type Default value Description
$data mixed - -

protectedgenerateMediaTypeWithVendor()

Generator.php : 346

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

protectedgetData()

Generator.php : 432
protected abstract getData() : DataObjectInterface

Return values

DataObjectInterface

protectedgetVendor()

Generator.php : 74
protected getVendor() : string

Return values

string