# betterdocs/3.8.9/includes/Dependencies/PhpParser/Node/Stmt/ClassLike.php

BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ &amp; Chatbot, version 3.8.9. 45 lines.

- Page: https://pluginprobe.com/plugins/betterdocs/3.8.9/code/includes/Dependencies/PhpParser/Node/Stmt/ClassLike.php
- Raw: https://pluginprobe.com/plugins/betterdocs/3.8.9/raw/includes/Dependencies/PhpParser/Node/Stmt/ClassLike.php
- Modified: 2023-08-14T08:41:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/betterdocs/3.8.9/code/includes/Dependencies/PhpParser/Node/Stmt/ClassLike.php#L10-L20`.

```php
<?php

namespace WPDeveloper\BetterDocs\Dependencies\PhpParser\Node\Stmt;

use WPDeveloper\BetterDocs\Dependencies\PhpParser\Node;

abstract class ClassLike extends Node\Stmt {
    /** @var string|null Name */
    public $name;
    /** @var Node[] Statements */
    public $stmts;

    /**
     * Gets all methods defined directly in this class/interface/trait
     *
     * @return ClassMethod[]
     */
    public function getMethods() {
        $methods = array();
        foreach ($this->stmts as $stmt) {
            if ($stmt instanceof ClassMethod) {
                $methods[] = $stmt;
            }
        }
        return $methods;
    }

    /**
     * Gets method with the given name defined directly in this class/interface/trait.
     *
     * @param string $name Name of the method (compared case-insensitively)
     *
     * @return ClassMethod|null Method node or null if the method does not exist
     */
    public function getMethod($name) {
        $lowerName = strtolower($name);
        foreach ($this->stmts as $stmt) {
            if ($stmt instanceof ClassMethod && $lowerName === strtolower($stmt->name)) {
                return $stmt;
            }
        }
        return null;
    }
}

```
