Metodo que permite obtener los elementos hijos y convertirlos en un objeto lista PHPHtmlDomList.
@return self
10025
private function get_childs()
    {
       $this->childs = new \PHPTools\PHPHtmlDom\Core\PHPHtmlDomList($this->dom_element->childNodes);

       return $this;
    }
224634
public function toXML()
    {
        $dom = new DOMDocument( '1.0', 'utf-8' );
        $dom->formatOutput = true;
        $success = $dom->loadXML('<page />');

        $pageNode = $dom->documentElement;

        foreach ( $this->attributes as $attrName => $attrValue )
        {
            switch ( $attrName )
            {
                case 'id':
                    $pageNode->setAttribute( 'id', $attrValue );
                    break;

                case 'zones':
                    foreach ( $this->attributes['zones'] as $zone )
                    {
                        $zoneNode = $zone->toXML( $dom );
                        $pageNode->appendChild( $zoneNode );
                    }
                    break;

                default:
                    $node = $dom->createElement( $attrName );
                    $nodeValue = $dom->createTextNode( $attrValue );
                    $node->appendChild( $nodeValue );
                    $pageNode->appendChild( $node );
                    break;
            }
        }

        return $dom->saveXML();
    }
453203
public function wrap()
    {
        $this->importNodes(\func_get_args(), function ($node, $imported_node) {
            if ($node->parentNode instanceof \DOMDocument) {
                throw new \Exception('Can not wrap inside root element '.$node->tagName.' of document');
            }

            // replace node with imported wrapper
            $old = $node->parentNode->replaceChild($imported_node, $node);
            // old node goes inside the most inner child of wrapper
            $target = $imported_node;
            while ($target->hasChildNodes()) {
                $target = $target->childNodes[0];
            }
            $target->appendChild($old);
        });

        return $this;
    }
79891
public function getHTML()
    {
        $clone = clone $this;
        foreach ($clone->_getNodesForCssSelector('[inlinestyle-original-style]') as $node) {
            $current = $node->hasAttribute("style") ?
                $this->_styleToArray($node->getAttribute("style")) :
                array();
            $original = $node->hasAttribute("inlinestyle-original-style") ?
                $this->_styleToArray($node->getAttribute("inlinestyle-original-style")) :
                array();

            $current = $clone->_mergeStyles($current, $original);

            $node->setAttribute("style", $this->_arrayToStyle($current));
            $node->removeAttribute('inlinestyle-original-style');
        }

        return $clone->_dom->saveHTML();
    }
458422
protected function parseParams():self
	{
		$params= preg_split('/(?<!\\\\)\\|/',$this->line->pregGet('/^-[\w-:]+\((.*?)\)(?= |(\\{>)?$)/',1));

		if( ($m= count($params)) != ($n= count($this->config['params'])) ){$this->document->throw("Tag $this->name has $n parameters $m given.");}

		array_map(function( $key, $value ){return $this->setAttribute($key,$this->checkExpression(str_replace('\\|','|',$value)));},$this->config['params'],$params);

		return $this;
	}
1350939
public function toString() {
		Theme::singleton()->updateElementClasses( $this );
		if ( $this->isInfusable() ) {
			$this->ensureInfusableId();
		}
		return parent::toString();
	}
98589
public function toDoc(): \DOMDocument
    {
        if (null === $this->document) {
            throw new XslProcessorException(
                    'Can not transform, set document or xml file to transform first'
            );
        }

        $this->registerCallbacks();
        $result = $this->xsltProcessor->transformToDoc($this->document);
        if (false === $result) {
            throw new XslProcessorException($this->createMessage());
        }

        return $result;
    }
95224
protected function Init()
    {
        $htmlWrap = ContentHtmlWrap::Schema()->ByContent($this->content);
        $this->html = $htmlWrap->GetHtml();
        $this->currentChild = $this->tree->FirstChildOf($this->item);
        return parent::Init();
    }
875137
public function toHtml()
	{
		if ( $this->hierarchies === null )
		{
			throw new Exception( "Hierarchies have not been generated.  Run preparePresentation() first." );
		}

		$this->log()->info( "Generate HTML" );

		$countYears = count( $this->years );
		$countEntities = count( $this->entities );
		$this->maxDepth++; // We're counting from zero
		$this->maxDepth++; // The sections are the zero'th items but do not figure in the depth calculation
		$totalColumns = $this->maxDepth + 0 + $countYears;

		// An array of alignments for the different elements
		// types such as string, number, date, boolean.
		// The type is taken from the element definition and
		// given an alignment by calling the 'valueAlignment'
		// function of the taxonomy class.  This information
		// is used to create CSS styles.
		$types = array();

		$dimensionInfos = array();
		$rows = array();
		// Process each of the roles to create report rows.
		// Each $rows entry is an array representing a <tr></tr> pair
		// and may contain sub-arrays representing the <td> elements
		foreach ( $this->hierarchies as $roleKey => $role )
		{
			if ( $this->taxonomy->excludeFromOutput( $roleKey ) ) continue;

			$roleHasItems = isset( $role['hierarchy'] ) && count( $role['hierarchy'] ) > 0;
			if ( ! $roleHasItems ) continue;

			$roleHypercubes = $this->getTaxonomy()->getPresentationRoleHypercubes( $roleKey );

			$roleHasDimensions = false;
			$roleHasDefaultDimensionMembers = false;
			$dimensionInfo = "";
			if ( $roleHypercubes )
			{
				$roleHasDimensions = array_reduce( $roleHypercubes, function( $carry, $hypercube ) { return $hypercube['dimensioncount'] + $carry; }, 0 );
			}

			if ( $roleHasDimensions )
			{
				$roleHasDefaultDimensionMembers = array_reduce( $roleHypercubes, function( $carry, $hypercube ) {
					return isset( $hypercube['hasdefaults'] ) ? $hypercube['hasdefaults'] + $carry : $carry;
				}, 0 );
			}

			if ( $roleHypercubes )
			{
				$countHypercubes = count( $roleHypercubes );
				$dimensionInfo = "(";

				$dimensionInfo .= $countHypercubes === 1 ? "1 hypercube" : "$countHypercubes hypercubes";

				if ( $roleHasDimensions )
				{
					$dimensionInfo .= " with $roleHasDimensions dimension" . ( $roleHasDimensions === 1 ? " " : "s " );
				}

				if ( $roleHasDimensions )
				{
					$dimensionInfo .= " - " . ($roleHasDefaultDimensionMembers ? "Has $roleHasDefaultDimensionMembers" : "No") . " default" . ( $roleHasDefaultDimensionMembers === 1 ? " " : "s " );
				}
				else
				{
					$dimensionInfo .= " No dimensions";
				}

				$dimensionInfo .= ")";

				$dimensionInfos[ $roleKey ] = $dimensionInfo;
			}

			unset( $roleHasHypercubes );

			$roleRows = array();
			if ( ( $rowCount = $this->processNode(
				$role['hierarchy'],
				$this->taxonomy,
				$types,
				$roleRows,
				$depth = 0,
				array(
					'maxDepth' => $this->maxDepth,
					'totalColumns' => $totalColumns,
					'countYears' => $countYears,
					'countEntities' => $countEntities,
				)
			) ) && $rowCount > 1 )
			{
				$companies = array();

				foreach ( $this->entities as $entity => $contexts )
					$companies[] = "<td class=\"value company\" colspan=\"{$countYears}\">{$entity}</td>";

				$rows[] = array(
					"<tr class=\"companies\" id=\"$roleKey-companies\">",
					array( "<td colspan=\"{$this->maxDepth}\">Section</td>" ),
					$companies,
					"</tr>",
				);

				$columns = array();

				foreach ( $this->entities as $entity => $contexts )
					foreach ( $this->years as $year => $contexts )
						$columns[] = "<td class=\"value heading\">{$year}</td>";

				$rows[] = array(
					"<tr class=\"years role\" id=\"$roleKey-years\">",
					array( "<td colspan=\"{$this->maxDepth}\">{$role['text']} $dimensionInfo</td>" ),
					$columns,
					"</tr>",
				);

				foreach ( $roleRows as $row ) $rows[] = $row;
			}
		}

		$column_count = ( $countYears * $countEntities ) + $this->maxDepth;
		$column_count_minus1 = $column_count -1;

		$content = array();
		end( $this->hierarchies );
		$lastKey = key( $this->hierarchies );
		foreach ( $this->hierarchies as $roleKey => $role )
		{
			$last = $roleKey === $lastKey ? " last" : "";
			$dimensionInfo = isset( $dimensionInfos[ $roleKey ] ) ? "<strong>{$dimensionInfos[ $roleKey ]}</strong>" : "";

			$content[] = array(
				"<tr id=\"$roleKey\" class=\"content-page$last\">",
				"<td/>",
				"<td colspan=\"{$column_count_minus1}\"><a href=\"#$roleKey-companies\">{$role['text']}</a> $dimensionInfo</td>",
				"</tr>",
			);
		}

		$heading = array( "<td class=\"filename\" colspan=\"{$this->maxDepth}\"></td>" );
		foreach ( $this->entities as $entityKey => $entity )
		{
			$document_name = $this->entityInstanceMap[ $entityKey ];
			$heading[] = "<td class=\"filename\" colspan=\"$countYears\">{$document_name}</td>";
		}

		$body = array(
			"<table class=\"reportTable\" cellspacing=\"0\" cellpadding=\"0\" >",
			array(
				"<thead>",
				"<meta charset=\"utf-8\"/>",
				array(
					"<tr>",
					array_fill( 0, $this->maxDepth -1, "<th class=\"text-columns\" />" ),
					array( "<th class=\"gap-column\"  />" ),
					array_fill( 0, $countYears * $countEntities, "<th class=\"value-columns\"  />" ),
					"</tr>",
				),
				"</thead>",
				"<tbody>",
				array(
					"<tr>",
					$heading,
					"</tr>",
				),
				$content,
				$rows,
				"</tbody>",
			),
			"</table>",
		);

		$style = array();
		foreach ( $types as $type => $alignment )
		{
			$style[] = "tr td." . str_replace( ":", "-", $type ) . " { text-align: $alignment; }";
		}

		// Build the head
		$head = array(
			"<style>",
			array(
				".reportTable tr.content-page.last td { padding-bottom: 30px; }",
				".reportTable td { border: 1px dotted #999999; }",
				".reportTable th.text-columns { min-width: 20px; }",
				".reportTable th.gap-column { width: 100%; }",
				".reportTable th.value-columns { min-width: 160px; }",
				".reportTable td.filename { text-align: center; }",
				"td { padding: 2px; vertical-align: top; min-width: 20px }",
				"tr.role{ border-top: 1px solid #999999; font-weight: bold; }",
				"tr.role td { border-top: 1px solid #999999; }",
				"tr td.value { border-left: 1px solid #999999; }",
				"tr td.value { text-align: left; }",
				"tr td.value.company, tr td.value.heading { text-align: center; }",
				"tr.tuple-gap > td.tuple { padding-top: 4px; border-top: 1px solid gray }",
				"tr.tuple-gap > td.description.tuple { padding-top: 4px; border-top: 1px solid gray }",
			),
			$style,
			"</style>",
		);

		$html = array(
			"<html>",
			array(
				"<head>",
				$head,
				"</head>",
			),
			array(
				"<body>",
				$body,
				"</body>",
			),
			"</html>",
		);

		$this->log()->info( "Flatten: {$this->elapsedTime()}" );
		$x = $this->flatten( $html );
		$this->log()->info( "Write: {$this->elapsedTime()}" );
		return join( "\n", $x );
	}
1234854
public function withoutDuplicates(): self
    {
        if (count($this->pairs) === count(array_count_values(array_column($this->pairs, 0)))) {
            return $this;
        }

        $pairs = array_reduce($this->pairs, [$this, 'removeDuplicates'], []);
        if ($pairs === $this->pairs) {
            return $this;
        }

        $clone = clone $this;
        $clone->pairs = $pairs;

        return $clone;
    }
547024
public static function dom(){
        $attr = self::$attr;
        $id = self::$attr['id'];

        $attr['placeholder'] = $attr['placeholder'] ? $attr['placeholder'] : $attr['label'];

        $attr['readonly'] = ($attr['readonly'] == '1') ? 'readonly' : '';

        $dom = <<<EOT
            <div class="layui-form-item" component-name="{$attr['component_name']}">
                <label class="layui-form-label">{$attr['label']}</label>
                <div class="layui-input-{$attr['display']}">
                    <input id="{$id}"  lay-verify="{$attr['layVerify']}" class="layui-input {$attr['component_name']} {$attr['classname']}" value="{$attr['value']}" name="{$attr['name']}" placeholder="{$attr['placeholder']}" {$attr['readonly']}>
                </div>
                <div class="layui-form-mid layui-word-aux">{$attr['helpinfo']}</div>
            </div>
EOT;

        return $dom;
    }
1021577
public function html()
    {
        if (!$this->nodes) {
            throw new \InvalidArgumentException('The current node list is empty.');
        }

        $html = '';
        foreach ($this->getNode(0)->childNodes as $child) {
            $html .= $child->ownerDocument->saveHTML($child);
        }

        return $html;
    }
146873
private function initDOMXPath()
    {
        $this->xpath = new DOMXPath($this);

        $simpleXML = new \SimpleXMLElement($this->saveXML());
        $namespaces = $simpleXML->getNamespaces(true);

        foreach ($namespaces as $name => $uri) {
            $name = $name ?: self::ROOT_NAMESPACE_NAME;
            $this->namespaces[$name] = $uri;
            $this->xpath->registerNamespace($name, $uri);
        }

        return $this;
    }
475122
public function toUnsignedXML() : DOMElement
    {
        $root = parent::toUnsignedXML();
        if (isset($this->any)) {
            $node = $root->ownerDocument->importNode($this->any, true);
            $root->appendChild($node);
        }

        return $root;
    }
1011404
public function innerHtml() {
		$innerHTML = "";
		$children = $this->node->childNodes;
		foreach ($children as $child) {
			$innerHTML .= $this->node->ownerDocument->saveHTML($child) ?: '';
		}
		return $innerHTML;
	}
859133
private function translate(): self
    {
        if (empty($this->translations)) {
            return $this;
        }

        $lang = $this->get('lang');

        foreach ($this->attributes as $key => $attribute) {
            if (in_array($key, $this->translations, true)) {
                $this->set($key, __($attribute, [], $lang));
            }
        }

        return $this;
    }
44767
public function before()
    {
        $this->importNodes(\func_get_args(), function ($node, $imported_node) {
            if ($node->parentNode instanceof \DOMDocument) {
                throw new \Exception('Can not set before root element '.$node->tagName.' of document');
            }

            $node->parentNode->insertBefore($imported_node, $node);
        });

        return $this;
    }