ISGenericXml
in package
AbstractYes
Class ISGenericXml
Table of Contents
Methods
- get_tag_content() : string|null
- Get the content of a specific XML tag.
- parse_json() : mixed
- Parse JSON content and populate the object properties.
- parse_xml() : mixed
- Parse XML content and populate the object properties.
- to_json() : string
- Convert the object to JSON format.
- to_json_with_array() : array<string|int, mixed>
- Convert the object to an associative array for JSON encoding.
- to_xml() : string
- Convert the object to XML format.
- get_property_value() : mixed
- Get the value of a property.
- set_property_value() : mixed
- Set the value of a property.
Methods
get_tag_content()
Get the content of a specific XML tag.
public
get_tag_content(string $tag, string $xml) : string|null
Parameters
- $tag : string
-
The tag name.
- $xml : string
-
The XML content.
Return values
string|null —The content of the tag or null if not found.
parse_json()
Parse JSON content and populate the object properties.
public
parse_json(string $json) : mixed
Parameters
- $json : string
-
The JSON content.
parse_xml()
Parse XML content and populate the object properties.
public
parse_xml(string $xml) : mixed
Parameters
- $xml : string
-
The XML content.
to_json()
Convert the object to JSON format.
public
to_json() : string
Return values
string —The JSON representation of the object.
to_json_with_array()
Convert the object to an associative array for JSON encoding.
public
to_json_with_array(array<string|int, mixed> $arr) : array<string|int, mixed>
Parameters
- $arr : array<string|int, mixed>
-
The initial array to populate.
Return values
array<string|int, mixed> —The associative array representation of the object.
to_xml()
Convert the object to XML format.
public
to_xml() : string
Return values
string —The XML representation of the object.
get_property_value()
Get the value of a property.
private
get_property_value(ReflectionProperty $prop) : mixed
Parameters
- $prop : ReflectionProperty
-
Property to get.
Return values
mixed —Value of the property.
set_property_value()
Set the value of a property.
private
set_property_value(ReflectionProperty $prop, mixed $value) : mixed
Parameters
- $prop : ReflectionProperty
-
Property to set.
- $value : mixed
-
Value to set.