<commit_before><?php

/*
 * SimpleXMLElement class file
 */

namespace Moneybird;

/**
 * Extension for SimpleXMLElement
 * @author <NAME>
 */
class SimpleXMLElement extends \SimpleXMLElement {

	/**
	 * Add CDATA text in a node
	 * @param string $cdata_text The CDATA value  to add
	 */
	protected function addCData($cdata_text) {
		$node = dom_import_simplexml($this);
		$no = $node->ownerDocument;
		$node->appendChild($no->createCDATASection($cdata_text));
	}

	/**
	 * Create a child with CDATA value
	 * @param string $name The name of the child element to add.
	 * @param string $cdata_text The CDATA value of the child element.
	 */
	public function addChildCData($name, $cdata_text) {
		$child = $this->addChild($name);
		$child->addCData($cdata_text);
	}

	/**
	 * Add SimpleXMLElement code into a SimpleXMLElement
	 * @param SimpleXMLElement $append
	 */
	public function appendXML(SimpleXMLElement $append) {
		if ($append) {
			if (strlen(trim((string) $append)) == 0) {
				$xml = $this->addChild($append->getName());
				foreach ($append->children() as $child) {
					$xml->appendXML($child);
				}
			} else {
				$xml = $this->addChild($append->getName(), (string) $append);
			}
			foreach ($append->attributes() as $n => $v) {
				$xml->addAttribute($n, $v);
			}
		}
	}
<commit_msg>appendXML fails on PHP5.4<commit_after><?php

/*
 * SimpleXMLElement class file
 */

namespace Moneybird;

/**
 * Extension for SimpleXMLElement
 * @author <NAME>
 */
class SimpleXMLElement extends \SimpleXMLElement {

	/**
	 * Add CDATA text in a node
	 * @param string $cdata_text The CDATA value  to add
	 */
	protected function addCData($cdata_text) {
		$node = dom_import_simplexml($this);
		$no = $node->ownerDocument;
		$node->appendChild($no->createCDATASection($cdata_text));
	}

	/**
	 * Create a child with CDATA value
	 * @param string $name The name of the child element to add.
	 * @param string $cdata_text The CDATA value of the child element.
	 */
	public function addChildCData($name, $cdata_text) {
		$child = $this->addChild($name);
		$child->addCData($cdata_text);
	}

	/**
	 * Add SimpleXMLElement code into a SimpleXMLElement
	 * @param SimpleXMLElement $append
	 */
	public function appendXML(SimpleXMLElement $append) {
		if (strlen(trim((string) $append)) == 0) {
			$xml = $this->addChild($append->getName());
			foreach ($append->children() as $child) {
				$xml->appendXML($child);
			}
		} else {
			$xml = $this->addChild($append->getName(), (string) $append);
		}
		foreach ($append->attributes() as $n => $v) {
			$xml->addAttribute($n, $v);
		}
	}

{'fraction_non_alphanumeric': 0.1540247678018576, 'fraction_numerical': 0.0015479876160990713, 'mean_word_length': 3.8408239700374533, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7349913', 'n_tokens_mistral': 939, 'n_tokens_neox': 857, 'n_words': 219}