ApiOpenStudio PHPDoc

DataContainer extends Entity
in package
Uses DetectTypeTrait, ConvertToArrayTrait, ConvertToBooleanTrait, ConvertToFileTrait, ConvertToFloatTrait, ConvertToHtmlTrait, ConvertToImageTrait, ConvertToIntegerTrait, ConvertToJsonTrait, ConvertToTextTrait, ConvertToUndefinedTrait, ConvertToXmlTrait

Class DataContainer

Provide s container for data to be passed between processors in a clean manner.

Table of Contents

$id  : mixed
Processor ID.
$details  : array<string|int, mixed>
An array of details of the processor, used to configure the frontend GUI and metadata construction.
$logger  : MonologWrapper
Logger object.
$meta  : array<string|int, mixed>
Metadata for the processor.
$request  : Request
All the request details.
$data  : mixed
Data.
$type  : string
Data type.
$types  : array<string|int, mixed>
All data types.
__construct()  : mixed
DataContainer constructor.
details()  : array<string|int, mixed>
Return details for processor.
detectType()  : string
Detect the type of data that is input .
fromArrayToArray()  : array<string|int, mixed>
Convert array to array.
fromArrayToBoolean()  : mixed
Convert array to boolean.
fromArrayToFile()  : bool
Convert array to file.
fromArrayToFloat()  : mixed
Convert an array to a float.
fromArrayToHtml()  : string
Convert array to HTML string.
fromArrayToImage()  : mixed
Convert array to image.
fromArrayToInteger()  : mixed
Convert an array to an integer.
fromArrayToJson()  : string|null
Convert array to JSON string.
fromArrayToText()  : null
Convert array to text.
fromArrayToUndefined()  : null
Convert array to undefined.
fromArrayToXml()  : string|null
Convert array to XML string.
fromBooleanToArray()  : array<string|int, mixed>
Convert boolean to array.
fromBooleanToBoolean()  : bool
Convert boolean to boolean.
fromBooleanToFile()  : bool
Convert boolean to file.
fromBooleanToFloat()  : float
Convert a boolean to a float.
fromBooleanToHtml()  : string
Convert boolean to HTML string.
fromBooleanToImage()  : mixed
Convert boolean to image.
fromBooleanToInteger()  : int
Convert a boolean to an integer.
fromBooleanToJson()  : bool|null
Convert boolean to JSON string.
fromBooleanToText()  : string
Convert boolean to text.
fromBooleanToUndefined()  : null
Convert boolean to undefined.
fromBooleanToXml()  : string
Convert boolean to XML string.
fromFileToArray()  : mixed
Convert file to array.
fromFileToBoolean()  : mixed
Convert file to boolean.
fromFileToFile()  : bool
Convert file to file.
fromFileToFloat()  : mixed
Convert a file to a float.
fromFileToHtml()  : string
Convert file to HTML string.
fromFileToImage()  : string
Convert file to image.
fromFileToInteger()  : mixed
Convert a file to an integer.
fromFileToJson()  : mixed
Convert file to JSON string.
fromFileToText()  : string
Convert file to text.
fromFileToUndefined()  : null
Convert file to undefined.
fromFileToXml()  : string
Convert file to XML string.
fromFloatToArray()  : array<string|int, mixed>
Convert float to array.
fromFloatToBoolean()  : bool
Convert float to boolean.
fromFloatToFile()  : bool
Convert float to file.
fromFloatToFloat()  : float
Convert a float to a float.
fromFloatToHtml()  : string
Convert float to HTML string.
fromFloatToImage()  : mixed
Convert float to image.
fromFloatToInteger()  : int|float
Convert a float to an integer.
fromFloatToJson()  : float|string|null
Convert float to JSON string.
fromFloatToText()  : string
Convert float to text.
fromFloatToUndefined()  : null
Convert float to undefined.
fromFloatToXml()  : string
Convert float to XML string.
fromHtmlToArray()  : array<string|int, mixed>
Convert HTML to array.
fromHtmlToBoolean()  : mixed
Convert HTML to boolean.
fromHtmlToFile()  : bool
Convert HTML to file.
fromHtmlToFloat()  : mixed
Convert an HTML string to a float.
fromHtmlToHtml()  : string
Convert an HTML string to HTML string.
fromHtmlToImage()  : mixed
Convert HTML to image.
fromHtmlToInteger()  : mixed
Convert an HTML string to an integer.
fromHtmlToJson()  : string
Convert an HTML string to JSON string.
fromHtmlToText()  : string
Convert HTML to text.
fromHtmlToUndefined()  : null
Convert HTML to undefined.
fromHtmlToXml()  : string
Convert an HTML string to XML string.
fromImageToArray()  : mixed
Convert image to array.
fromImageToBoolean()  : mixed
Convert image to boolean.
fromImageToFile()  : bool
Convert image to file.
fromImageToFloat()  : mixed
Convert an image to a float.
fromImageToHtml()  : string
Convert an image string to HTML string.
fromImageToImage()  : string
Convert image to image.
fromImageToInteger()  : mixed
Convert an image to an integer.
fromImageToJson()  : string|null
Convert an image string to JSON string.
fromImageToText()  : string
Convert image to text.
fromImageToUndefined()  : null
Convert image to undefined.
fromImageToXml()  : string
Convert an image string to XML string.
fromIntegerToArray()  : array<string|int, mixed>
Convert integer to array.
fromIntegerToBoolean()  : bool
Convert integer to boolean.
fromIntegerToFile()  : bool
Convert integer to file.
fromIntegerToFloat()  : float
Convert an integer to a float.
fromIntegerToHtml()  : string
Convert integer to HTML string.
fromIntegerToImage()  : mixed
Convert integer to image.
fromIntegerToInteger()  : int
Convert an integer to an integer.
fromIntegerToJson()  : int|string|null
Convert integer to JSON string.
fromIntegerToText()  : string
Convert integer to text.
fromIntegerToUndefined()  : null
Convert integer to undefined.
fromIntegerToXml()  : string
Convert integer to XML string.
fromJsonToArray()  : array<string|int, mixed>
Convert JSON string to array.
fromJsonToBoolean()  : bool
Convert JSON string to boolean.
fromJsonToFile()  : bool
Convert JSON to file.
fromJsonToFloat()  : float
Convert a JSON string to a float.
fromJsonToHtml()  : string
Convert JSON string to HTML string.
fromJsonToImage()  : mixed
Convert JSON to image.
fromJsonToInteger()  : float|int|null
Convert a JSON string to an integer.
fromJsonToJson()  : mixed
Convert JSON string to JSON string.
fromJsonToText()  : string
Convert JSON to text.
fromJsonToUndefined()  : null
Convert JSON to undefined.
fromJsonToXml()  : string
Convert JSON string to XML string.
fromTextToArray()  : array<string|int, mixed>
Convert text to array.
fromTextToBoolean()  : bool
Convert text to boolean.
fromTextToFile()  : bool
Convert text to file.
fromTextToFloat()  : float|int|mixed|null
Convert text to a float.
fromTextToHtml()  : string
Convert text to HTML string.
fromTextToImage()  : string
Convert text to image.
fromTextToInteger()  : int|float|null
Convert text to an integer.
fromTextToJson()  : string|null
Convert text to JSON string.
fromTextToText()  : string
Convert text to text.
fromTextToUndefined()  : null
Convert text to undefined.
fromTextToXml()  : string
Convert text to XML string.
fromUndefinedToArray()  : null
Convert undefined to array.
fromUndefinedToBoolean()  : null
Convert undefined to boolean.
fromUndefinedToFile()  : null
Convert undefined to file.
fromUndefinedToFloat()  : null
Convert undefined to float.
fromUndefinedToHtml()  : string
Convert undefined to HTML.
fromUndefinedToImage()  : null
Convert undefined to image.
fromUndefinedToInteger()  : null
Convert undefined to integer.
fromUndefinedToJson()  : null
Convert undefined to JSON.
fromUndefinedToText()  : null
Convert Undefined to text.
fromUndefinedToUndefined()  : null
Convert undefined to undefined.
fromUndefinedToXml()  : string
Convert undefined to XML.
fromXmlToArray()  : array<string|int, mixed>
Convert XML string to array.
fromXmlToBoolean()  : mixed
Convert XML to boolean.
fromXmlToFile()  : bool
Convert XML to file.
fromXmlToFloat()  : mixed
Convert an XML string to a float.
fromXmlToHtml()  : string
Convert XML string to HTML string.
fromXmlToImage()  : mixed
Convert XML to image.
fromXmlToInteger()  : mixed
Convert an XML string to an integer.
fromXmlToJson()  : string
Convert XML string to JSON string.
fromXmlToText()  : string
Convert XML to text.
fromXmlToUndefined()  : null
Convert XML to undefined.
fromXmlToXml()  : string
Convert XML string to XML string.
getData()  : mixed
Get the data.
getType()  : string
Get the data type.
getTypes()  : array<string|int, mixed>
Fetch all possible data types.
isArray()  : bool
Validate a variable is an array.
isBool()  : bool
Validate a variable is boolean.
isEmpty()  : bool
Validate a variable is empty.
isFloat()  : bool
Validate a variable is float.
isHtml()  : bool
Validate a variable is HTML.
isInt()  : bool
Validate a variable is integer.
isJson()  : bool
Validate a variable is JSON.
isXml()  : bool
Validate a variable is XML.
process()  : mixed
Main processor function.
setData()  : mixed
Set the data.
setType()  : mixed
Set the data type.
val()  : mixed|DataContainer
Process a variable into a final result for the processor.
array2xml()  : string
Recursive method to convert an array into XML format.
fromArrayToDataList()  : string
Convert array to HTML Data List string.
getBaseXmlWrapper()  : SimpleXMLElement
Get the base SimpleXMLElement wrapper for XML for converting non XML inputs to XML output.
getCastMethod()  : string
Calculate the required cast method.
isDataContainer()  : bool
Validate if a set of data is wrapped in a DataContainer object.
wrapDataHtmlFormat()  : string
Wrap Data in HTML string wrapper.
validateAllowedTypes()  : void
Validate an input for allowed variable types
validateAllowedValues()  : void
Validate an input for allowed values.

Properties

$id

Processor ID.

public mixed $id = ''

Processor ID.

$details

An array of details of the processor, used to configure the frontend GUI and metadata construction.

protected array<string|int, mixed> $details = array()

Details of the processor.

Indexes: 'name' (string): Human readable name of the processor.

'machineName' (string): Machine name of the processor in snake case.

'description' (string): Description of the processor.

'menu' (string): Lists the immediate menu parents.

examples: 'menu' => 'menu1' - belongs to menu1

'conditional' (optional, boolean):

ApiOpenStudio usually parses the node tree using depth-first iteration. In some cases, this may be wasteful because a processor may require conditional branching, in which case, we do not want to parse all comparison values until we know what branch we will take, i.e. in if_then_else processor, we do not need to process both the 'then' and the 'else' branches.

If omitted or set to false: The parsing will continue as normal (depth-first).

If set to true: The processor will be calculated and then the result branch will be returned and added to the stack.

'input': List the input nodes for this processor This is an array with the following indexes:

'description' (string): description of what the processor does

'cardinality': (int min, mixed max) e.g. [0, 1] max can be integer or ''. '' = infinite

'literalAllowed' (boolean): Allow liter values.

'limitValues' (array|mixed): Limit the result values passed into the processor.

'limitProcessors' (array|string): Limit the input processors.

'limitTypes' (array): an array of input type this processor will accept. Possible values: file literal bool numeric integer text float bool

'conditional' (optional): In the case of branching processors (see 'preprocess' above), this indicates if the input is a conditional input or required for the logic comparison.

examples: input => [ 'sources' => [ 'description' => 'desc1', 'cardinality' => [1, '*'], type => ['literal'] ] ] This processor has only one input, called sources. Sources must contain at least one value. The inputs can only be a literal value.

 input => [
   'method' => [
     'description' => 'desc1',
     'cardinality' => [1, 1],
     'literalAllowed': true
     'limitType': ['text'],
     'limitValues' => ["get", "post"]
   ],
   'auth' => [
      'description' => 'desc2',
      'cardinality' => [1, 1],
      'limitProcessors' => ['var_get'],
   ],
   'vars' => [
      'description' => 'desc3',
      'cardinality' => [0, '*'],
       limitTypes => ['integer'],
   ],
   't' => [
      'description' => 'desc4',
      'cardinality' => [0, '*'],
      'limitProcessors' => ['field'],
   ],
 ]

 This Processor has 4 inputs:

     method, which has only one input, of type text, with only 2 possible values ('get' and 'post'),
         literals are allowed.
     auth, which has only one value, of type processor (var_get).
     vars, which can contain:
         0 or many values
         Must be an integer
         with no limit on value
     t, which can take or many input of Processor Field.

$meta

Metadata for the processor.

protected array<string|int, mixed> $meta

$request

All the request details.

protected Request $request

Request.

$type

Data type.

private string $type = 'undefined'

Default data type

$types

All data types.

private array<string|int, mixed> $types = ['array', 'boolean', 'file', 'float', 'html', 'image', 'integer', 'json', 'text', 'undefined', 'xml']

Data types.

Methods

__construct()

DataContainer constructor.

public __construct(mixed $data[, string|null $type = null ]) : mixed

If the data type is specified, the data will automatically be cast to this type.

Parameters
$data : mixed

Data stored in the container.

$type : string|null = null

Data type.

Tags
throws
ApiException
Return values
mixed

details()

Return details for processor.

public details() : array<string|int, mixed>
Return values
array<string|int, mixed>

detectType()

Detect the type of data that is input .

public detectType(mixed $data) : string
Parameters
$data : mixed

Data to test.

Return values
string

The data type.

fromArrayToArray()

Convert array to array.

public fromArrayToArray(array<string|int, mixed> $array) : array<string|int, mixed>
Parameters
$array : array<string|int, mixed>
Return values
array<string|int, mixed>

fromArrayToBoolean()

Convert array to boolean.

public fromArrayToBoolean(array<string|int, mixed> $array) : mixed
Parameters
$array : array<string|int, mixed>
Tags
throws
ApiException
Return values
mixed

fromArrayToFile()

Convert array to file.

public fromArrayToFile( $data) : bool
Parameters
$data :
Tags
throws
ApiException
Return values
bool

fromArrayToFloat()

Convert an array to a float.

public fromArrayToFloat(array<string|int, mixed> $array) : mixed
Parameters
$array : array<string|int, mixed>
Tags
throws
ApiException
Return values
mixed

fromArrayToHtml()

Convert array to HTML string.

public fromArrayToHtml(array<string|int, mixed>|null $array) : string

If the array does not have a html element at the root, then the array will be converted to a data-list and will be appended to the body of the new HTML doc.

Parameters
$array : array<string|int, mixed>|null
Return values
string

fromArrayToImage()

Convert array to image.

public fromArrayToImage(array<string|int, mixed> $array) : mixed
Parameters
$array : array<string|int, mixed>
Tags
throws
ApiException
Return values
mixed

fromArrayToInteger()

Convert an array to an integer.

public fromArrayToInteger(array<string|int, mixed> $array) : mixed
Parameters
$array : array<string|int, mixed>
Tags
throws
ApiException
Return values
mixed

fromArrayToJson()

Convert array to JSON string.

public fromArrayToJson(array<string|int, mixed>|null $array) : string|null
Parameters
$array : array<string|int, mixed>|null
Return values
string|null

fromArrayToText()

Convert array to text.

public fromArrayToText(array<string|int, mixed>|null $array) : null
Parameters
$array : array<string|int, mixed>|null
Tags
throws
ApiException
Return values
null

fromArrayToUndefined()

Convert array to undefined.

public fromArrayToUndefined(array<string|int, mixed> $array) : null
Parameters
$array : array<string|int, mixed>
Return values
null

fromArrayToXml()

Convert array to XML string.

public fromArrayToXml(array<string|int, mixed>|null $array) : string|null
Parameters
$array : array<string|int, mixed>|null
Tags
throws
ApiException
Return values
string|null

fromBooleanToArray()

Convert boolean to array.

public fromBooleanToArray(bool $boolean) : array<string|int, mixed>
Parameters
$boolean : bool
Return values
array<string|int, mixed>

fromBooleanToBoolean()

Convert boolean to boolean.

public fromBooleanToBoolean(bool $boolean) : bool
Parameters
$boolean : bool
Return values
bool

fromBooleanToFile()

Convert boolean to file.

public fromBooleanToFile( $data) : bool
Parameters
$data :
Return values
bool

fromBooleanToFloat()

Convert a boolean to a float.

public fromBooleanToFloat(bool $boolean) : float
Parameters
$boolean : bool
Return values
float

fromBooleanToHtml()

Convert boolean to HTML string.

public fromBooleanToHtml(bool|null $boolean) : string

The boolean will be within a div in the body of the new HTML doc.

Parameters
$boolean : bool|null
Return values
string

fromBooleanToImage()

Convert boolean to image.

public fromBooleanToImage(bool $boolean) : mixed
Parameters
$boolean : bool
Tags
throws
ApiException
Return values
mixed

fromBooleanToInteger()

Convert a boolean to an integer.

public fromBooleanToInteger(bool $boolean) : int
Parameters
$boolean : bool
Return values
int

fromBooleanToJson()

Convert boolean to JSON string.

public fromBooleanToJson(bool|null $boolean) : bool|null
Parameters
$boolean : bool|null
Return values
bool|null

fromBooleanToText()

Convert boolean to text.

public fromBooleanToText(bool|null $boolean) : string
Parameters
$boolean : bool|null
Return values
string

fromBooleanToUndefined()

Convert boolean to undefined.

public fromBooleanToUndefined(bool $boolean) : null
Parameters
$boolean : bool
Return values
null

fromBooleanToXml()

Convert boolean to XML string.

public fromBooleanToXml(bool|null $boolean) : string
Parameters
$boolean : bool|null
Return values
string

fromFileToArray()

Convert file to array.

public fromFileToArray( $file) : mixed
Parameters
$file :
Tags
throws
ApiException
Return values
mixed

fromFileToBoolean()

Convert file to boolean.

public fromFileToBoolean( $file) : mixed
Parameters
$file :
Tags
throws
ApiException
Return values
mixed

fromFileToFile()

Convert file to file.

public fromFileToFile( $data) : bool
Parameters
$data :
Return values
bool

fromFileToFloat()

Convert a file to a float.

public fromFileToFloat( $file) : mixed
Parameters
$file :
Tags
throws
ApiException
Return values
mixed

fromFileToHtml()

Convert file to HTML string.

public fromFileToHtml( $file) : string
Parameters
$file :
Return values
string

fromFileToImage()

Convert file to image.

public fromFileToImage( $file) : string
Parameters
$file :
Return values
string

fromFileToInteger()

Convert a file to an integer.

public fromFileToInteger( $file) : mixed
Parameters
$file :
Tags
throws
ApiException
Return values
mixed

fromFileToJson()

Convert file to JSON string.

public fromFileToJson( $file) : mixed
Parameters
$file :
Tags
throws
ApiException
Return values
mixed

fromFileToText()

Convert file to text.

public fromFileToText( $file) : string
Parameters
$file :
Return values
string

fromFileToUndefined()

Convert file to undefined.

public fromFileToUndefined( $file) : null
Parameters
$file :
Return values
null

fromFileToXml()

Convert file to XML string.

public fromFileToXml( $file) : string
Parameters
$file :
Return values
string

fromFloatToArray()

Convert float to array.

public fromFloatToArray(float $float) : array<string|int, mixed>
Parameters
$float : float
Return values
array<string|int, mixed>

fromFloatToBoolean()

Convert float to boolean.

public fromFloatToBoolean(float $float) : bool
Parameters
$float : float
Tags
throws
ApiException
Return values
bool

fromFloatToFile()

Convert float to file.

public fromFloatToFile( $data) : bool
Parameters
$data :
Return values
bool

fromFloatToFloat()

Convert a float to a float.

public fromFloatToFloat(float $float) : float
Parameters
$float : float
Return values
float

fromFloatToHtml()

Convert float to HTML string.

public fromFloatToHtml(float|null $float) : string

The float will be within a div in the body of the new HTML doc.

Parameters
$float : float|null
Return values
string

fromFloatToImage()

Convert float to image.

public fromFloatToImage(float $float) : mixed
Parameters
$float : float
Tags
throws
ApiException
Return values
mixed

fromFloatToInteger()

Convert a float to an integer.

public fromFloatToInteger(float $float) : int|float
Parameters
$float : float
Tags
throws
ApiException
Return values
int|float

fromFloatToJson()

Convert float to JSON string.

public fromFloatToJson(float|string|null $float) : float|string|null
Parameters
$float : float|string|null
Return values
float|string|null

fromFloatToText()

Convert float to text.

public fromFloatToText(float|null $float) : string
Parameters
$float : float|null
Return values
string

fromFloatToUndefined()

Convert float to undefined.

public fromFloatToUndefined(float $float) : null
Parameters
$float : float
Return values
null

fromFloatToXml()

Convert float to XML string.

public fromFloatToXml(float|null $float) : string
Parameters
$float : float|null
Return values
string

fromHtmlToArray()

Convert HTML to array.

public fromHtmlToArray(string $html) : array<string|int, mixed>
Parameters
$html : string
Return values
array<string|int, mixed>

fromHtmlToBoolean()

Convert HTML to boolean.

public fromHtmlToBoolean(string $html) : mixed
Parameters
$html : string
Tags
throws
ApiException
Return values
mixed

fromHtmlToFile()

Convert HTML to file.

public fromHtmlToFile( $data) : bool
Parameters
$data :
Return values
bool

fromHtmlToFloat()

Convert an HTML string to a float.

public fromHtmlToFloat(string $html) : mixed
Parameters
$html : string
Tags
throws
ApiException
Return values
mixed

fromHtmlToHtml()

Convert an HTML string to HTML string.

public fromHtmlToHtml(string $html) : string
Parameters
$html : string
Return values
string

fromHtmlToImage()

Convert HTML to image.

public fromHtmlToImage(string $html) : mixed
Parameters
$html : string
Tags
throws
ApiException
Return values
mixed

fromHtmlToInteger()

Convert an HTML string to an integer.

public fromHtmlToInteger(string $html) : mixed
Parameters
$html : string
Tags
throws
ApiException
Return values
mixed

fromHtmlToJson()

Convert an HTML string to JSON string.

public fromHtmlToJson(string $html) : string
Parameters
$html : string
Return values
string

fromHtmlToText()

Convert HTML to text.

public fromHtmlToText(string $html) : string
Parameters
$html : string
Return values
string

fromHtmlToUndefined()

Convert HTML to undefined.

public fromHtmlToUndefined(string $html) : null
Parameters
$html : string
Return values
null

fromHtmlToXml()

Convert an HTML string to XML string.

public fromHtmlToXml(string|null $html) : string
Parameters
$html : string|null
Return values
string

fromImageToArray()

Convert image to array.

public fromImageToArray( $image) : mixed
Parameters
$image :
Tags
throws
ApiException
Return values
mixed

fromImageToBoolean()

Convert image to boolean.

public fromImageToBoolean( $image) : mixed
Parameters
$image :
Tags
throws
ApiException
Return values
mixed

fromImageToFile()

Convert image to file.

public fromImageToFile( $data) : bool
Parameters
$data :
Return values
bool

fromImageToFloat()

Convert an image to a float.

public fromImageToFloat( $image) : mixed
Parameters
$image :
Tags
throws
ApiException
Return values
mixed

fromImageToHtml()

Convert an image string to HTML string.

public fromImageToHtml( $image) : string
Parameters
$image :
Return values
string

fromImageToImage()

Convert image to image.

public fromImageToImage( $image) : string
Parameters
$image :
Return values
string

fromImageToInteger()

Convert an image to an integer.

public fromImageToInteger( $image) : mixed
Parameters
$image :
Tags
throws
ApiException
Return values
mixed

fromImageToJson()

Convert an image string to JSON string.

public fromImageToJson( $image) : string|null
Parameters
$image :
Return values
string|null

fromImageToText()

Convert image to text.

public fromImageToText( $image) : string
Parameters
$image :
Return values
string

fromImageToUndefined()

Convert image to undefined.

public fromImageToUndefined( $image) : null
Parameters
$image :
Return values
null

fromImageToXml()

Convert an image string to XML string.

public fromImageToXml( $image) : string
Parameters
$image :
Return values
string

fromIntegerToArray()

Convert integer to array.

public fromIntegerToArray(int $integer) : array<string|int, mixed>
Parameters
$integer : int
Return values
array<string|int, mixed>

fromIntegerToBoolean()

Convert integer to boolean.

public fromIntegerToBoolean(int $integer) : bool
Parameters
$integer : int
Tags
throws
ApiException
Return values
bool

fromIntegerToFile()

Convert integer to file.

public fromIntegerToFile( $data) : bool
Parameters
$data :
Return values
bool

fromIntegerToFloat()

Convert an integer to a float.

public fromIntegerToFloat(int $integer) : float
Parameters
$integer : int
Return values
float

fromIntegerToHtml()

Convert integer to HTML string.

public fromIntegerToHtml(int|float|null $integer) : string

The integer will be within a div in the body of the new HTML doc.

Parameters
$integer : int|float|null
Return values
string

fromIntegerToImage()

Convert integer to image.

public fromIntegerToImage(int $integer) : mixed
Parameters
$integer : int
Tags
throws
ApiException
Return values
mixed

fromIntegerToInteger()

Convert an integer to an integer.

public fromIntegerToInteger(int $integer) : int
Parameters
$integer : int
Return values
int

fromIntegerToJson()

Convert integer to JSON string.

public fromIntegerToJson(int|string|null $integer) : int|string|null
Parameters
$integer : int|string|null
Return values
int|string|null

fromIntegerToText()

Convert integer to text.

public fromIntegerToText(int|float|null $integer) : string
Parameters
$integer : int|float|null
Return values
string

fromIntegerToUndefined()

Convert integer to undefined.

public fromIntegerToUndefined(int $integer) : null
Parameters
$integer : int
Return values
null

fromIntegerToXml()

Convert integer to XML string.

public fromIntegerToXml(int|float|null $integer) : string
Parameters
$integer : int|float|null
Return values
string

fromJsonToArray()

Convert JSON string to array.

public fromJsonToArray( $json) : array<string|int, mixed>
Parameters
$json :
Return values
array<string|int, mixed>

fromJsonToBoolean()

Convert JSON string to boolean.

public fromJsonToBoolean(string $json) : bool
Parameters
$json : string
Tags
throws
ApiException
Return values
bool

fromJsonToFile()

Convert JSON to file.

public fromJsonToFile( $data) : bool
Parameters
$data :
Return values
bool

fromJsonToFloat()

Convert a JSON string to a float.

public fromJsonToFloat(string $json) : float
Parameters
$json : string
Tags
throws
ApiException
Return values
float

fromJsonToHtml()

Convert JSON string to HTML string.

public fromJsonToHtml(string|null $json) : string
Parameters
$json : string|null
Return values
string

fromJsonToImage()

Convert JSON to image.

public fromJsonToImage(string $json) : mixed
Parameters
$json : string
Tags
throws
ApiException
Return values
mixed

fromJsonToInteger()

Convert a JSON string to an integer.

public fromJsonToInteger(string $json) : float|int|null
Parameters
$json : string
Tags
throws
ApiException
Return values
float|int|null

fromJsonToJson()

Convert JSON string to JSON string.

public fromJsonToJson( $json) : mixed
Parameters
$json :
Return values
mixed

fromJsonToText()

Convert JSON to text.

public fromJsonToText(string $json) : string
Parameters
$json : string
Return values
string

fromJsonToUndefined()

Convert JSON to undefined.

public fromJsonToUndefined(string $json) : null
Parameters
$json : string
Return values
null

fromJsonToXml()

Convert JSON string to XML string.

public fromJsonToXml(string|null $json) : string
Parameters
$json : string|null
Return values
string

fromTextToArray()

Convert text to array.

public fromTextToArray(string $text) : array<string|int, mixed>
Parameters
$text : string
Return values
array<string|int, mixed>

fromTextToBoolean()

Convert text to boolean.

public fromTextToBoolean(string $text) : bool
Parameters
$text : string
Tags
throws
ApiException
Return values
bool

fromTextToFile()

Convert text to file.

public fromTextToFile( $data) : bool
Parameters
$data :
Return values
bool

fromTextToFloat()

Convert text to a float.

public fromTextToFloat(string $text) : float|int|mixed|null
Parameters
$text : string
Tags
throws
ApiException
Return values
float|int|mixed|null

fromTextToHtml()

Convert text to HTML string.

public fromTextToHtml(string $text) : string

The text will be within a div in the body of the new HTML doc.

Parameters
$text : string
Return values
string

fromTextToImage()

Convert text to image.

public fromTextToImage(string $text) : string
Parameters
$text : string
Return values
string

fromTextToInteger()

Convert text to an integer.

public fromTextToInteger(string $text) : int|float|null
Parameters
$text : string
Tags
throws
ApiException
Return values
int|float|null

fromTextToJson()

Convert text to JSON string.

public fromTextToJson(string|null $text) : string|null
Parameters
$text : string|null
Return values
string|null

fromTextToText()

Convert text to text.

public fromTextToText(string $text) : string
Parameters
$text : string
Return values
string

fromTextToUndefined()

Convert text to undefined.

public fromTextToUndefined(string $string) : null
Parameters
$string : string
Return values
null

fromTextToXml()

Convert text to XML string.

public fromTextToXml(string|null $text) : string
Parameters
$text : string|null
Return values
string

fromUndefinedToArray()

Convert undefined to array.

public fromUndefinedToArray( $data) : null
Parameters
$data :
Return values
null

fromUndefinedToBoolean()

Convert undefined to boolean.

public fromUndefinedToBoolean( $data) : null
Parameters
$data :
Return values
null

fromUndefinedToFile()

Convert undefined to file.

public fromUndefinedToFile( $data) : null
Parameters
$data :
Return values
null

fromUndefinedToFloat()

Convert undefined to float.

public fromUndefinedToFloat( $data) : null
Parameters
$data :
Return values
null

fromUndefinedToHtml()

Convert undefined to HTML.

public fromUndefinedToHtml( $data) : string

Creates an empty HTML doc.

Parameters
$data :
Return values
string

fromUndefinedToImage()

Convert undefined to image.

public fromUndefinedToImage( $data) : null
Parameters
$data :
Return values
null

fromUndefinedToInteger()

Convert undefined to integer.

public fromUndefinedToInteger( $data) : null
Parameters
$data :
Return values
null

fromUndefinedToJson()

Convert undefined to JSON.

public fromUndefinedToJson( $data) : null
Parameters
$data :
Return values
null

fromUndefinedToText()

Convert Undefined to text.

public fromUndefinedToText( $data) : null
Parameters
$data :
Return values
null

fromUndefinedToUndefined()

Convert undefined to undefined.

public fromUndefinedToUndefined( $data) : null
Parameters
$data :
Return values
null

fromUndefinedToXml()

Convert undefined to XML.

public fromUndefinedToXml( $data) : string
Parameters
$data :
Return values
string

fromXmlToArray()

Convert XML string to array.

public fromXmlToArray(string $xml) : array<string|int, mixed>
Parameters
$xml : string
Return values
array<string|int, mixed>

fromXmlToBoolean()

Convert XML to boolean.

public fromXmlToBoolean(string $xml) : mixed
Parameters
$xml : string
Tags
throws
ApiException
Return values
mixed

fromXmlToFile()

Convert XML to file.

public fromXmlToFile( $data) : bool
Parameters
$data :
Return values
bool

fromXmlToFloat()

Convert an XML string to a float.

public fromXmlToFloat(string $xml) : mixed
Parameters
$xml : string
Tags
throws
ApiException
Return values
mixed

fromXmlToHtml()

Convert XML string to HTML string.

public fromXmlToHtml(string $xml) : string
Parameters
$xml : string
Return values
string

fromXmlToImage()

Convert XML to image.

public fromXmlToImage(string $xml) : mixed
Parameters
$xml : string
Tags
throws
ApiException
Return values
mixed

fromXmlToInteger()

Convert an XML string to an integer.

public fromXmlToInteger(string $xml) : mixed
Parameters
$xml : string
Tags
throws
ApiException
Return values
mixed

fromXmlToJson()

Convert XML string to JSON string.

public fromXmlToJson(string $xml) : string
Parameters
$xml : string
Tags
throws
ApiException
Return values
string

fromXmlToText()

Convert XML to text.

public fromXmlToText(string $xml) : string
Parameters
$xml : string
Return values
string

fromXmlToUndefined()

Convert XML to undefined.

public fromXmlToUndefined(string $xml) : null
Parameters
$xml : string
Return values
null

fromXmlToXml()

Convert XML string to XML string.

public fromXmlToXml(string|null $xml) : string
Parameters
$xml : string|null
Return values
string

getData()

Get the data.

public getData() : mixed
Return values
mixed

getType()

Get the data type.

public getType() : string
Return values
string

getTypes()

Fetch all possible data types.

public getTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>

isArray()

Validate a variable is an array.

public isArray(mixed $var) : bool
Parameters
$var : mixed

Variable to test.

Return values
bool

isBool()

Validate a variable is boolean.

public isBool(mixed $var) : bool
Parameters
$var : mixed

Variable to test.

Return values
bool

isEmpty()

Validate a variable is empty.

public isEmpty(mixed $var) : bool
Parameters
$var : mixed

Variable to test.

Return values
bool

isFloat()

Validate a variable is float.

public isFloat(mixed $var) : bool
Parameters
$var : mixed

Variable to test.

Return values
bool

isHtml()

Validate a variable is HTML.

public isHtml(mixed $var) : bool
Parameters
$var : mixed

Variable to test.

Return values
bool

isInt()

Validate a variable is integer.

public isInt(mixed $var) : bool
Parameters
$var : mixed

Variable to test.

Return values
bool

isJson()

Validate a variable is JSON.

public isJson(mixed $var) : bool
Parameters
$var : mixed

Variable to test.

Return values
bool

isXml()

Validate a variable is XML.

public isXml(mixed $var) : bool
Parameters
$var : mixed

Variable to test.

Return values
bool

process()

Main processor function.

public process() : mixed

This is where the magic happens, and should be overridden by all derived classes.

Fetches and process the processor described in the metadata. It is also the 1st stop to recursive processing of processors, so the place validate user credentials.

Tags
throws
ApiException
Return values
mixed

setData()

Set the data.

public setData(mixed $data) : mixed

Data type is automatically detected and set.

Parameters
$data : mixed

Data.

Return values
mixed

setType()

Set the data type.

public setType(string $type) : mixed

This will also cast the data to the new type.

Parameters
$type : string

Data type.

Tags
throws
ApiException
Return values
mixed

val()

Process a variable into a final result for the processor.

public val(string $key[, bool|null $rawData = false ]) : mixed|DataContainer

This method can be used to process a value in its meta to return a final result that it can use. If the object is a processor, then it will process that down to a final return value, or if the obj is a simple value, then it will return that. Anything else will return an error object.

Setting $realValue to true will force the value to be the actual value, rather than a potential dataContainer.

Parameters
$key : string

The key for the input variable in the meta.

$rawData : bool|null = false

Return the raw data or a DataContainer.

Tags
throws
ApiException

Invalid key or data.

Return values
mixed|DataContainer

array2xml()

Recursive method to convert an array into XML format.

protected array2xml(array<string|int, mixed> $array, SimpleXMLElement $xml) : string
Parameters
$array : array<string|int, mixed>

Input array.

$xml : SimpleXMLElement

A SimpleXMLElement element.

Return values
string

A populated SimpleXMLElement.

fromArrayToDataList()

Convert array to HTML Data List string.

protected fromArrayToDataList(array<string|int, mixed> $array) : string
Parameters
$array : array<string|int, mixed>
Return values
string

getBaseXmlWrapper()

Get the base SimpleXMLElement wrapper for XML for converting non XML inputs to XML output.

protected getBaseXmlWrapper([string $baseTag = 'apiOpenStudioWrapper' ]) : SimpleXMLElement
Parameters
$baseTag : string = 'apiOpenStudioWrapper'
Tags
throws
ApiException
Return values
SimpleXMLElement

getCastMethod()

Calculate the required cast method.

protected getCastMethod( $data, string $type) : string
Parameters
$data :
$type : string
Tags
throws
ApiException
Return values
string

isDataContainer()

Validate if a set of data is wrapped in a DataContainer object.

protected isDataContainer(mixed $data) : bool
Parameters
$data : mixed

DataContainer or raw data.

Return values
bool

wrapDataHtmlFormat()

Wrap Data in HTML string wrapper.

protected wrapDataHtmlFormat(string $body[, string $pageTitle = 'HTML generated by ApiOpenStudio' ]) : string
Parameters
$body : string

Body content.

$pageTitle : string = 'HTML generated by ApiOpenStudio'

HTML doc title.

Return values
string

validateAllowedTypes()

Validate an input for allowed variable types

private validateAllowedTypes(string $type, array<string|int, mixed> $limitTypes, int $min, string $key) : void
Parameters
$type : string

Input value type.

$limitTypes : array<string|int, mixed>

List of limit on variable types.

$min : int

Minimum number of values.

$key : string

The key of the input being validated.

Tags
throws
ApiException

Invalid data type.

Return values
void

validateAllowedValues()

Validate an input for allowed values.

private validateAllowedValues(mixed $val, array<string|int, mixed> $limitValues, int $min, string $key) : void
Parameters
$val : mixed

Input value.

$limitValues : array<string|int, mixed>

List of allowed values.

$min : int

Minimum number of values.

$key : string

The key of the input being validated.

Tags
throws
ApiException

Invalid value.

Return values
void

Search results