Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Parser.php

function Parser::isSameJSXElementName

Checks that 2 tag names are equal

Parameters

\Peast\Syntax\Node\Node $n1 First name:

\Peast\Syntax\Node\Node $n2 Second name:

Return value

bool

1 call to Parser::isSameJSXElementName()
Parser::parseJSXElement in vendor/mck89/peast/lib/Peast/Syntax/JSX/Parser.php
Parses a jsx element

File

vendor/mck89/peast/lib/Peast/Syntax/JSX/Parser.php, line 418

Class

Parser
JSX parser trait

Namespace

Peast\Syntax\JSX

Code

protected function isSameJSXElementName($n1, $n2) {
    $type = $n1->getType();
    if ($type !== $n2->getType()) {
        return false;
    }
    elseif ($type === "JSXNamespacedName") {
        return $this->isSameJSXElementName($n1->getNamespace(), $n2->getNamespace()) && $this->isSameJSXElementName($n1->getName(), $n2->getName());
    }
    elseif ($type === "JSXMemberExpression") {
        return $this->isSameJSXElementName($n1->getObject(), $n2->getObject()) && $this->isSameJSXElementName($n1->getProperty(), $n2->getProperty());
    }
    return $type === "JSXIdentifier" && $n1->getName() === $n2->getName();
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal