model/modx/modconnectorresponse.class.php
- package
- modx
- Classes
- modConnectorResponse
Description
modConnectorResponse
\modConnectorResponse
- Extends from
- \modResponse
- extends
- modResponse
- package
- modx
- Properties
- $_directory
- Methods
- __construct
- _decodeLiterals
- _encodeLiterals
- outputArray
- outputContent
- setDirectory
- toJSON
Description
Encapsulates an HTTP response from the MODX manager.
{@inheritdoc}
Properties
$_directory
string $_directory = ''
The base location of the processors called by the connectors.
Details
- string
- visibility
- protected
- default
- final
- false
- static
- false
- access
- private
Methods
__construct
__construct(
$modx
)
:
Arguments
- $modx
Details
- visibility
- public
- final
- false
- static
- false
_decodeLiterals
_decodeLiterals(
string $string
)
:
string
Decodes strings encoded by _encodeLiterals to restore JavaScript literals.
Arguments
- $string
- string
The JSON-encoded string with encoded literals.
Output
- string
- The JSON-encoded string with literals restored.
Details
- visibility
- protected
- final
- false
- static
- false
- access
- protected
_encodeLiterals
_encodeLiterals(
mixed $value, integer|string $key
)
:
Encodes certain JavaScript literal strings for later decoding.
Arguments
- $value
- mixed
&$value A reference to the value to be encoded if it is identified as a literal. - $key
- integerstring
The array key corresponding to the value.
Details
- visibility
- protected
- final
- false
- static
- false
- access
- protected
outputArray
outputArray(
array $array, mixed $count
=
false
)
:
string
Return arrays of objects (with count) converted to JSON.
The JSON result includes two main elements, total and results. This format is used for list results.
Arguments
- $array
- array
An array of data objects. - $count
- mixed
The total number of objects. Used for pagination.
Output
- string
- The JSON output.
Details
- visibility
- public
- final
- false
- static
- false
- access
- public
outputContent
outputContent(
array $options
=
array
)
:
Overrides modResponse::outputContent to provide connector-specific processing.
{@inheritdoc}
Arguments
- $options
- array
Various options that can be set.
Details
- visibility
- public
- final
- false
- static
- false
setDirectory
setDirectory(
string $dir
)
:
Set the physical location of the processor directory for the response handler.
This allows for dynamic processor locations.
Arguments
- $dir
- string
The directory to set as the processors directory.
Details
- visibility
- public
- final
- false
- static
- false
- access
- public
toJSON
toJSON(
mixed $data
)
:
string
Converts PHP to JSON with JavaScript literals left in-tact.
JSON does not allow JavaScript literals, but this function encodes certain identifiable literals and decodes them back into literals after modX::toJSON() formats the data.
Arguments
- $data
- mixed
The PHP data to be converted.
Output
- string
- The extended JSON-encoded string.
Details
- visibility
- public
- final
- false
- static
- false
- access
- public