PVConversions

PVConversions is a class used to convert one data type to another.

Often there will be requirements for converting data such as array to objects, json to xml, etc. This class is designed to have built-in functions to make those conversations easy.

Example:

//Create an array
$data = $array('Apple', 'Bananna', 'Orange');

//Convert the array to object
$data = PVConversions::arrayToObject($data);

//Will display an stdObject
print_r($data);
package

data

Methods

Converts an array to an object using the stdClass,

arrayToObject(array $data) : \stdClass
static
access

public

Arguments

$data

array

An array of data

Response

\stdClass

$data The return array in an object format

Converts a boolean that is passed a string to the boolean type true or false.

convertTextBoolean(string $boolean) : boolean
static

Arguments

$boolean

string

The boolean as a string

Response

boolean

Converts an object to type array. Keep in mind that that private and protected variables may not be returned

objectToArray(object $object) : array
static
access

public

Arguments

$object

object

An object

Response

array

$array, The passed object in array formart/

Converts an xml document into an array.

xmlToArray( $xml) : array
static
access

public

Arguments

$xml

Response

array

$array The xml documented converted into an array