private static function getVueAttributeExpressions(
        array $attributePrefixes,
        DOMElement $dom,
        array &$expressionByLine = []
    ) {
        $children = $dom->childNodes;

        for ($i = 0; $i < $children->length; $i++) {
            $node = $children->item($i);

            if (!($node instanceof DOMElement)) {
                continue;
            }
            $attrList = $node->attributes;

            for ($j = 0; $j < $attrList->length; $j++) {
                /** @var DOMAttr $domAttr */
                $domAttr = $attrList->item($j);

                // Check if this is a dynamic vue attribute
                if (self::isAttributeMatching($domAttr->name, $attributePrefixes)) {
                    $line = $domAttr->getLineNo();
                    $expressionByLine += [$line => []];
                    $expressionByLine[$line][] = $domAttr->value;
                }
            }

            if ($node->hasChildNodes()) {
                $expressionByLine = self::getVueAttributeExpressions($attributePrefixes, $node, $expressionByLine);
            }
        }

        return $expressionByLine;
    }
private static function getVueAttributeExpressions(
        array $attributePrefixes,
        DOMElement $dom,
        array &$expressionByLine = []
    ) {
        $children = $dom->childNodes;

        for ($i = 0; $i < $children->length; $i++) {
            $node = $children->item($i);

            if (!($node instanceof DOMElement)) {
                continue;
            }
            $attrList = $node->attributes;

            for ($j = 0; $j < $attrList->length; $j++) {
                /** @var DOMAttr $domAttr */
                $domAttr = $attrList->item($j);

                // Check if this is a dynamic vue attribute
                if (self::isAttributeMatching($domAttr->name, $attributePrefixes)) {
                    $line = $domAttr->getLineNo();
                    $expressionByLine += [$line => []];
                    $expressionByLine[$line][] = $domAttr->value;
                }
            }

            if ($node->hasChildNodes()) {
                $expressionByLine = self::getVueAttributeExpressions($attributePrefixes, $node, $expressionByLine);
            }
        }

        return $expressionByLine;
    }
private static function getVueAttributeExpressions ( array $ attributePrefixes , DOMElement $ dom , array & $ expressionByLine = [ ] ) { $ children = $ dom -> childNodes ; for ( $ i = 0 ; $ i < $ children -> length ; $ i ++ ) { $ node = $ children -> item ( $ i ) ; if ( ! ( $ node instanceof DOMElement ) ) { continue ; } $ attrList = $ node -> attributes ; for ( $ j = 0 ; $ j < $ attrList -> length ; $ j ++ ) { /** @var DOMAttr $domAttr */ $ domAttr = $ attrList -> item ( $ j ) ; // Check if this is a dynamic vue attribute if ( self :: isAttributeMatching ( $ domAttr -> name , $ attributePrefixes ) ) { $ line = $ domAttr -> getLineNo ( ) ; $ expressionByLine += [ $ line => [ ] ] ; $ expressionByLine [ $ line ] [ ] = $ domAttr -> value ; } } if ( $ node -> hasChildNodes ( ) ) { $ expressionByLine = self :: getVueAttributeExpressions ( $ attributePrefixes , $ node , $ expressionByLine ) ; } } return $ expressionByLine ; }
Loop DOM element recursively and parse out all dynamic vue attributes which are basically JS expressions

@param array $attributePrefixes List of attribute prefixes we parse as JS (may contain translations)
@param DOMElement $dom
@param array $expressionByLine [lineNumber => [jsExpression, ..], ..]
@return array [lineNumber => [jsExpression, ..], ..]
Loop DOM element recursively and parse out all dynamic vue attributes which are basically JS expressions