__construct()
_init()
forge()
to_array()
to_csv()
to_json()
to_jsonp()
to_php()
to_serialized()
to_xml()
to_yaml()
_from_csv()
_from_xml()
_from_yaml()
pretty_json()
_from_json()
_from_serialize()
$_data
$ignore_namespaces
Format class
Help convert between various formats such as XML, JSON, CSV, etc.
package | Fuel |
---|---|
category | Core |
author | Fuel Development Team |
copyright | 2010 - 2012 Fuel Development Team |
link | http://docs.fuelphp.com/classes/format.html |
__construct(mixed $data, string $from_type, mixed $param)
mixed
general date to be converted
string
data format the file was provided in
mixed
additional parameter that can be passed on to a 'from' method
\FuelException |
---|
_init()
forge(mixed $data, string $from_type, mixed $param) : \Fuel\Core\Format
echo Format::forge(array('foo' => 'bar'))->to_xml();
mixed
general date to be converted
string
data format the file was provided in
mixed
additional parameter that can be passed on to a 'from' method
to_array(mixed $data) : array
Goes through the input and makes sure everything is either a scalar value or array
mixed
array
to_csv(mixed $data, mixed $delimiter, mixed $enclose_numbers, array $headings) : string
mixed
mixed
mixed
array
Custom headings to use
string
to_json(mixed $data, bool $pretty) : string
mixed
bool
whether to make the json pretty
string
to_jsonp(mixed $data, bool $pretty, string $callback) : string
mixed
bool
whether to make the json pretty
string
JSONP callback
string
formatted JSONPto_php(mixed $data) : string
mixed
string
to_serialized(mixed $data) : string
mixed
string
to_xml(mixed $data, null $structure, null | string $basenode, null | bool $use_cdata, mixed $bool_representation) : string
mixed
null
null
string
null
bool
whether to use CDATA in nodes
mixed
if true, element values are true/false. if 1, 1/0.
string
to_yaml(mixed $data) : string
mixed
string
_from_csv(string $string, bool $no_headings) : array
string
bool
array
_from_xml(string $string, bool $recursive) : array
string
bool
array
_from_yaml(string $string) : array
string
array
pretty_json(string $data) : string | false
Borrowed from http://www.php.net/manual/en/function.json-encode.php#80339
string
json encoded array
string
false
pretty json output or false when the input was not valid_from_json(string $string) : mixed
string
mixed
_from_serialize(string $string) : mixed
string
mixed
$_data : array | mixed
$ignore_namespaces : bool