- * @param object $doc XML root
- * @param string $element XML element name
- * @param string $value XML value
- * @param array $attributes array containing the attributes
+ * @param \DOMDocument $doc XML root
+ * @param string $element XML element name
+ * @param string $value XML value
+ * @param array $attributes array containing the attributes
- public static function createElement($doc, $element, $value = "", $attributes = [])
+ public static function createElement(\DOMDocument $doc, $element, $value = "", $attributes = [])
* @param object $parent parent object
* @param string $element XML element name
* @param string $value XML value
* @param array $attributes array containing the attributes
* @return void
*/
* @param object $parent parent object
* @param string $element XML element name
* @param string $value XML value
* @param array $attributes array containing the attributes
* @return void
*/
- public static function addElement($doc, $parent, $element, $value = "", $attributes = [])
+ public static function addElement(\DOMDocument $doc, $parent, $element, $value = "", $attributes = [])
{
$element = self::createElement($doc, $element, $value, $attributes);
$parent->appendChild($element);
{
$element = self::createElement($doc, $element, $value, $attributes);
$parent->appendChild($element);
* (namespaces, lowercase tags, get_attribute default changed, more...)
*
* Examples: $array = Xml::toArray(file_get_contents('feed.xml'));
* (namespaces, lowercase tags, get_attribute default changed, more...)
*
* Examples: $array = Xml::toArray(file_get_contents('feed.xml'));
- * $array = Xml::toArray(file_get_contents('feed.xml', true, 1, 'attribute'));
+ * $array = Xml::toArray(file_get_contents('feed.xml', true, 1, 'attribute'));
- * @param object $contents The XML text
- * @param boolean $namespaces True or false include namespace information
- * in the returned array as array elements.
- * @param integer $get_attributes 1 or 0. If this is 1 the function will get the attributes as well as the tag values -
- * this results in a different array structure in the return value.
- * @param string $priority Can be 'tag' or 'attribute'. This will change the way the resulting
- * array sturcture. For 'tag', the tags are given more importance.
+ * @param object $contents The XML text
+ * @param boolean $namespaces True or false include namespace information
+ * in the returned array as array elements.
+ * @param integer $get_attributes 1 or 0. If this is 1 the function will get the attributes as well as the tag values -
+ * this results in a different array structure in the return value.
+ * @param string $priority Can be 'tag' or 'attribute'. This will change the way the resulting
+ * array sturcture. For 'tag', the tags are given more importance.
*/
public static function toArray($contents, $namespaces = true, $get_attributes = 1, $priority = 'attribute')
{
*/
public static function toArray($contents, $namespaces = true, $get_attributes = 1, $priority = 'attribute')
{
{
$result = $xpath->evaluate($element, $context);
if (!is_object($result)) {
{
$result = $xpath->evaluate($element, $context);
if (!is_object($result)) {
{
$result = $xpath->query($element, $context);
if (!is_object($result)) {
{
$result = $xpath->query($element, $context);
if (!is_object($result)) {