JsonPointer

Implementation of <a href="https://tools.ietf.org/html/rfc6901">RFC6901 Json Pointers</a>.

package

Default

Methods

__construct

__construct() 

Append an unescaped <code>token</code> to this pointer <br/> Note: If you provide escaped path the behaviour is undefined

append( $arg0) : $this

param $token [string] the unescaped reference token append($token)

Append the index as reference token to JsonPointer

param $index [integer] append($index)

Append an unescaped list of tokens to JsonPointer
Note: If you provide escaped paths the behaviour is undefined

param $tokens [array] unescaped reference tokens append($tokens)

Append all tokens of pointer to this pointer
Note: The base URI of this pointer will remain untouched

param $pointer [JsonPointer] other pointer append($pointer)

Arguments

$arg0

string | array | integer | JsonPointer

Response

$this

a reference to this, so the API can be used fluently

Copy a JsonPointer

copy() : \io\vertx\jphp\core\json\pointer\JsonPointer

Response

\io\vertx\jphp\core\json\pointer\JsonPointer

a copy of this pointer

Build an empty JsonPointer

create() : \io\vertx\jphp\core\json\pointer\JsonPointer
static

Response

\io\vertx\jphp\core\json\pointer\JsonPointer

a new empty JsonPointer

Build a JsonPointer from a json pointer string

from( $arg0) : \io\vertx\jphp\core\json\pointer\JsonPointer
static

Arguments

$arg0

string

Response

\io\vertx\jphp\core\json\pointer\JsonPointer

new instance of JsonPointer

Return <code>true</code> if the pointer is local (URI with only fragment)

isLocalPointer() : boolean

Response

boolean

Return <code>true</code> if this pointer is a parent pointer of <code>child</code>.

isParent( $arg0) : boolean


For instance "/properties" pointer is parent pointer of "/properties/parent"

Arguments

$arg0

JsonPointer

Response

boolean

Return <code>true</code> if the pointer is a root pointer

isRootPointer() : boolean

Response

boolean

Remove last reference token of this pointer

parent() : $this

Response

$this

a reference to this, so the API can be used fluently

Query <code>objectToQuery</code> using the provided @see \io\vertx\jphp\core\json\pointer\JsonPointerIterator. <br/> If you need to query Vert.x json data structures, use @see \io\vertx\jphp\core\json\pointer\JsonPointer::queryJson<br/> Note: if this pointer is a root pointer, this function returns the provided object

query( $arg0,  $arg1) : mixed

Arguments

$arg0

mixed

$arg1

JsonPointerIterator

Response

mixed

null if pointer points to not existing value, otherwise the requested value

Query <code>jsonElement</code>. <br/> Note: if this pointer is a root pointer, this function returns the provided json element

queryJson( $arg0) : mixed

Arguments

$arg0

mixed

Response

mixed

null if pointer points to not existing value, otherwise the requested value

Query <code>jsonElement</code>. If the query result is null, returns the default.<br/> Note: if this pointer is a root pointer, this function returns the provided object

queryJsonOrDefault( $arg0,  $arg1) : mixed

Arguments

$arg0

mixed

$arg1

mixed

Response

mixed

null if pointer points to not existing value, otherwise the requested value

Query <code>objectToQuery</code> using the provided @see \io\vertx\jphp\core\json\pointer\JsonPointerIterator. If the query result is null, returns the default. <br/> If you need to query Vert.x json data structures, use @see \io\vertx\jphp\core\json\pointer\JsonPointer::queryJsonOrDefault<br/> Note: if this pointer is a root pointer, this function returns the provided object

queryOrDefault( $arg0,  $arg1,  $arg2) : mixed

Arguments

$arg0

mixed

$arg1

JsonPointerIterator

$arg2

mixed

Response

mixed

null if pointer points to not existing value, otherwise the requested value

Build a <a href="https://tools.ietf.org/html/rfc6901#section-5">string representation</a> of the JSON Pointer

toString() : string

Response

string

Query <code>objectToQuery</code> tracing each element walked during the query, including the first and the result (if any).<br/> The first element of the list is objectToQuery and the last is the result, or the element before the first null was encountered

tracedQuery( $arg0,  $arg1) : array

Arguments

$arg0

mixed

$arg1

JsonPointerIterator

Response

array

the stream of walked elements

Write <code>newElement</code> in <code>objectToWrite</code> using this pointer. The path token "-" is handled as append to end of array <br/> If you need to write in Vert.x json data structures, use @see \io\vertx\jphp\core\json\pointer\JsonPointer::writeJson (Object)}<br/>

write( $arg0,  $arg1,  $arg2,  $arg3) : mixed

Arguments

$arg0

mixed

$arg1

JsonPointerIterator

$arg2

mixed

$arg3

boolean

Response

mixed

a reference to objectToWrite if the write was completed, a reference to newElement if the pointer is a root pointer, null if the write failed

Write <code>newElement</code> in <code>jsonElement</code> using this pointer. The path token "-" is handled as append to end of array.

writeJson( $arg0,  $arg1,  $arg2 = null) : mixed

param $jsonElement [mixed] json element to query and write param $newElement [mixed] json to insert writeJson($jsonElement, $newElement)

Write newElement in jsonElement using this pointer. The path token "-" is handled as append to end of array.

param $jsonElement [mixed] json to query and write param $newElement [mixed] json to insert param $createOnMissing [boolean] create JsonObject when missing a object key or an array index writeJson($jsonElement, $newElement, $createOnMissing)

Arguments

$arg0

mixed

$arg1

mixed

$arg2

boolean

Response

mixed

a reference to json if the write was completed, a reference to newElement if the pointer is a root pointer, null if the write failed