Automattic\WooCommerce\EmailEditor\Engine\Renderer

Html2Text::next_child_nameprivate staticWC 1.0

Get the next child name

Method of the class: Html2Text{}

No Hooks.

Returns

String|null. The next child name.

Usage

$result = Html2Text::next_child_name( ?\DOMNode $node ): ?string;
?\DOMNode $node(required)
.

Html2Text::next_child_name() code WC 10.8.1

private static function next_child_name( ?\DOMNode $node ): ?string {
	// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
	if ( null === $node || null === $node->nextSibling ) {
		return null;
	}

	// Get the next child.
	// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
	$next_node = $node->nextSibling;
	while ( null !== $next_node ) {
		if ( $next_node instanceof \DOMText ) {
			// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
			if ( ! self::is_whitespace( $next_node->wholeText ) ) {
				break;
			}
		}

		if ( $next_node instanceof \DOMElement ) {
			break;
		}

		// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
		$next_node = $next_node->nextSibling;
	}

	$next_name = null;
	if ( $next_node instanceof \DOMElement || $next_node instanceof \DOMText ) {
		// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
		$next_name = strtolower( $next_node->nodeName );
	}

	return $next_name;
}