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

Breadcrumb

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

function ClassLike::getMethod

Gets method with the given name defined directly in this class/interface/trait.

Parameters

string $name Name of the method (compared case-insensitively):

Return value

ClassMethod|null Method node or null if the method does not exist

File

vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php, line 100

Class

ClassLike

Namespace

PhpParser\Node\Stmt

Code

public function getMethod(string $name) : ?ClassMethod {
    $lowerName = strtolower($name);
    foreach ($this->stmts as $stmt) {
        if ($stmt instanceof ClassMethod && $lowerName === $stmt->name
            ->toLowerString()) {
            return $stmt;
        }
    }
    return null;
}

API Navigation

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