PHP Класс Peekmo\JsonPath\JsonStore

Copyright (c) 2007 Stefan Goessner (goessner.net) Licensed under the MIT (MIT-LICENSE.txt) licence. Modified by Axel Anceau
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
__construct ( string | array | stdClass $data )
add ( string $parentexpr, mixed $value, string $name = "" ) : boolean Adds one or more elements matching the given json path expression
get ( string $expr, boolean $unique = false ) : array Gets elements matching the given JsonPath expression
remove ( string $expr ) : boolean Removes all elements matching the given jsonpath expression
set ( string $expr, mixed $value ) : boolean Sets the value for all elements matching the given JsonPath expression
setData ( string | array | stdClass $data ) Sets JsonStore's manipulated data
toArray ( ) : array Returns the given json string to array
toObject ( ) : stdClass Returns the given json string to object
toString ( ) : string JsonEncoded version of the object

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

Метод Описание
normalizedFirst ( $expr )

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

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

public __construct ( string | array | stdClass $data )
$data string | array | stdClass

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

Adds one or more elements matching the given json path expression
public add ( string $parentexpr, mixed $value, string $name = "" ) : boolean
$parentexpr string JsonPath expression to the parent
$value mixed Value to add
$name string Key name
Результат boolean returns true if success

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

Gets elements matching the given JsonPath expression
public get ( string $expr, boolean $unique = false ) : array
$expr string JsonPath expression
$unique boolean Gets unique results or not
Результат array

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

Removes all elements matching the given jsonpath expression
public remove ( string $expr ) : boolean
$expr string JsonPath expression
Результат boolean returns true if success

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

Sets the value for all elements matching the given JsonPath expression
public set ( string $expr, mixed $value ) : boolean
$expr string JsonPath expression
$value mixed Value to set
Результат boolean returns true if success

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

Sets JsonStore's manipulated data
public setData ( string | array | stdClass $data )
$data string | array | stdClass

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

Returns the given json string to array
public toArray ( ) : array
Результат array

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

Returns the given json string to object
public toObject ( ) : stdClass
Результат stdClass

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

JsonEncoded version of the object
public toString ( ) : string
Результат string