MLPHP


MLPHP\JSONDocument
MarkLogic/MLPHP/JSONDocument.php at line 25

Class JSONDocument

Document
└─JSONDocument

public class JSONDocument
extends Document

Represents a JSON document.

Author:
Mike Wooldridge

Constructor Summary
void

__construct(RESTClient client, string uri)

Create a JSON document object.

Method Summary
string

read(string uri, array params)

Read a JSON document from the database.

Document

write(string uri, array params)

Write a JSON document to the database.

boolean

isValidJSON(mixed json)

Check if JSON content is valid.

Object

getAsObject()

Get the document as a PHP object.

array

getAsArray()

Get the document as a PHP associative array.

Methods inherited from MLPHP\Document
__construct, delete, deleteMetadata, getConnection, getContent, getContentType, getFileMimeType, getResponse, getURI, hasContent, read, readMetadata, setConnection, setContent, setContentFile, setContentType, setURI, write, writeMetadata

Constructor Detail

MarkLogic/MLPHP/JSONDocument.php at line 33

__construct

public void __construct(RESTClient client, string uri)

Create a JSON document object.

Parameters:
client - A REST client object.
uri - A document URI.

Method Detail

MarkLogic/MLPHP/JSONDocument.php at line 46

read

public string read(string uri, array params)

Read a JSON document from the database.

Parameters:
uri - A document URI.
params - Optional additional parameters to pass when reading.
Returns:
The document content.
See Also:
Document::getContent()

MarkLogic/MLPHP/JSONDocument.php at line 60

write

public Document write(string uri, array params)

Write a JSON document to the database.

Parameters:
uri - A document URI.
params - Optional additional parameters to pass when writing.
Returns:
$this

MarkLogic/MLPHP/JSONDocument.php at line 76

isValidJSON

public boolean isValidJSON(mixed json)

Check if JSON content is valid.

Returns:
true or false.

MarkLogic/MLPHP/JSONDocument.php at line 86

getAsObject

public Object getAsObject()

Get the document as a PHP object.

Returns:
A PHP object.

MarkLogic/MLPHP/JSONDocument.php at line 96

getAsArray

public array getAsArray()

Get the document as a PHP associative array.

Returns:
An associative array.

MLPHP