PHP Класс FluentDOM\Loader\Json\JsonDOM

Наследование: implements FluentDOM\Loadable, use trait FluentDOM\Loader\Supports\Json
Показать файл Открыть проект

Открытые методы

Метод Описание
__construct ( integer $options, integer $depth = 100 ) Create the loader for a json string.
getSupported ( ) : string[]
getTypeFromValue ( mixed $value ) : string Get the type from a variable value.
getValueAsString ( string $type, mixed $value ) : null | string
load ( mixed $source, string $contentType, array | Traversable | Options $options = [] ) : Document | Result | null Load the json string into an DOMDocument
loadFragment ( string $source, string $contentType, array | Traversable | Options $options = [] ) : DocumentFragment | null
onMapKey ( null | FALSE | callable $callback = NULL ) : callable | null Get/Set a mapping callback for the tag names. If it is a callable it will be set. FALSE removes the callback.

Защищенные методы

Метод Описание
transferTo ( DOMNode $target, mixed $value, integer $recursions = 100 ) Transfer a value into a target xml element node. This sets attributes on the target node and creates child elements for object and array values.

Приватные методы

Метод Описание
getQualifiedName ( string $key, string $default, boolean $isArrayElement = FALSE ) : string Get a valid qualified name (tag name) using the property name/key.
transferArrayTo ( DOMNode $target, array $value, integer $recursions ) Transfer an array value into a target element node. Sets the json:type attribute to 'array' and creates child element nodes for each array element using the default QName.
transferObjectTo ( DOMNode $target, object $value, integer $recursions ) Transfer an object value into a target element node. If the object has no properties, the json:type attribute is always set to 'object'. If verbose is not set the json:type attribute will be omitted if the object value has properties.

Описание методов

__construct() публичный Метод

The string will be decoded into a php variable structure and convert into a DOM document If options contains is self::OPTION_VERBOSE, the DOMNodes will all have json:type and json:name attributes. Even if the information could be read from the structure.
public __construct ( integer $options, integer $depth = 100 )
$options integer
$depth integer

getSupported() публичный Метод

public getSupported ( ) : string[]
Результат string[]

getTypeFromValue() публичный Метод

Get the type from a variable value.
public getTypeFromValue ( mixed $value ) : string
$value mixed
Результат string

getValueAsString() публичный Метод

public getValueAsString ( string $type, mixed $value ) : null | string
$type string
$value mixed
Результат null | string

load() публичный Метод

Load the json string into an DOMDocument
public load ( mixed $source, string $contentType, array | Traversable | Options $options = [] ) : Document | Result | null
$source mixed
$contentType string
$options array | Traversable | Options
Результат FluentDOM\Document | FluentDOM\Loader\Result | null

loadFragment() публичный Метод

public loadFragment ( string $source, string $contentType, array | Traversable | Options $options = [] ) : DocumentFragment | null
$source string
$contentType string
$options array | Traversable | Options
Результат FluentDOM\DocumentFragment | null

onMapKey() публичный Метод

function callback(string $key, boolean $isArrayElement) }
public onMapKey ( null | FALSE | callable $callback = NULL ) : callable | null
$callback null | FALSE | callable
Результат callable | null

transferTo() защищенный Метод

If the current element is an object or array the method is called recursive. The $recursions parameter is used to limit the recursion depth of this function.
protected transferTo ( DOMNode $target, mixed $value, integer $recursions = 100 )
$target DOMNode
$value mixed
$recursions integer