src/Tag.php
private static function buildArray(&$array, $tag_object, $options = [])
    {
        self::checkBuildOptions($options);

        if (in_array($tag_object->getTag(), self::$special_tags)) {
            $array[] = [trim((string) $tag_object)];
        } elseif (!isset($options['ignore_tags']) || !in_array($tag_object->getTag(), $options['ignore_tags'])) {
            $array[] = [
                $tag_object->getTag(),
                self::buildHtmlAttribute($tag_object->getAttributes()),
                $tag_object->getText(),
                [],
            ];
        }

        if ($tag_object->hasChildNodes()) {
            if (isset($options['ignore_tags']) && in_array($tag_object->getTag(), $options['ignore_tags'])) {
                foreach ($tag_object->getChildNodes() as $child_tag_object) {
                    self::buildArray($array, $child_tag_object);
                }

                return;
            }

            foreach ($tag_object->getChildNodes() as $child_tag_object) {
                $current_position = count($array) - 1;
                if (isset($array[$current_position][3]) && !is_null($array[$current_position][3])) {
                    self::buildArray($array[count($array) - 1][3], $child_tag_object);
                }
            }
        }
    }
private static function buildArray(&$array, $tag_object, $options = [])
    {
        self::checkBuildOptions($options);

        if (in_array($tag_object->getTag(), self::$special_tags)) {
            $array[] = [trim((string) $tag_object)];
        } elseif (!isset($options['ignore_tags']) || !in_array($tag_object->getTag(), $options['ignore_tags'])) {
            $array[] = [
                $tag_object->getTag(),
                self::buildHtmlAttribute($tag_object->getAttributes()),
                $tag_object->getText(),
                [],
            ];
        }

        if ($tag_object->hasChildNodes()) {
            if (isset($options['ignore_tags']) && in_array($tag_object->getTag(), $options['ignore_tags'])) {
                foreach ($tag_object->getChildNodes() as $child_tag_object) {
                    self::buildArray($array, $child_tag_object);
                }

                return;
            }

            foreach ($tag_object->getChildNodes() as $child_tag_object) {
                $current_position = count($array) - 1;
                if (isset($array[$current_position][3]) && !is_null($array[$current_position][3])) {
                    self::buildArray($array[count($array) - 1][3], $child_tag_object);
                }
            }
        }
    }
private static function buildArray ( & $ array , $ tag_object , $ options = [ ] ) { self :: checkBuildOptions ( $ options ) ; if ( in_array ( $ tag_object -> getTag ( ) , self :: $ special_tags ) ) { $ array [ ] = [ trim ( ( string ) $ tag_object ) ] ; } elseif ( ! isset ( $ options [ 'ignore_tags' ] ) || ! in_array ( $ tag_object -> getTag ( ) , $ options [ 'ignore_tags' ] ) ) { $ array [ ] = [ $ tag_object -> getTag ( ) , self :: buildHtmlAttribute ( $ tag_object -> getAttributes ( ) ) , $ tag_object -> getText ( ) , [ ] , ] ; } if ( $ tag_object -> hasChildNodes ( ) ) { if ( isset ( $ options [ 'ignore_tags' ] ) && in_array ( $ tag_object -> getTag ( ) , $ options [ 'ignore_tags' ] ) ) { foreach ( $ tag_object -> getChildNodes ( ) as $ child_tag_object ) { self :: buildArray ( $ array , $ child_tag_object ) ; } return ; } foreach ( $ tag_object -> getChildNodes ( ) as $ child_tag_object ) { $ current_position = count ( $ array ) - 1 ; if ( isset ( $ array [ $ current_position ] [ 3 ] ) && ! is_null ( $ array [ $ current_position ] [ 3 ] ) ) { self :: buildArray ( $ array [ count ( $ array ) - 1 ] [ 3 ] , $ child_tag_object ) ; } } } }
Build an array from this object.

@param array                  &$array
@param LaravelHtmlBuilder\Tag $tag_object
@param array                  $options

@return void
Build an array from this object .