PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 3.8.9
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v3.8.9
4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 All 200 releases
betterdocs / includes / Dependencies / PhpParser / Node / Stmt / ClassLike.php

ClassLike.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 3.8.9, at includes/Dependencies/PhpParser/Node/Stmt/ClassLike.php

45 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPDeveloper\BetterDocs\Dependencies\PhpParser\Node\Stmt;
4
5 use WPDeveloper\BetterDocs\Dependencies\PhpParser\Node;
6
7 abstract class ClassLike extends Node\Stmt {
8 /** @var string|null Name */
9 public $name;
10 /** @var Node[] Statements */
11 public $stmts;
12
13 /**
14 * Gets all methods defined directly in this class/interface/trait
15 *
16 * @return ClassMethod[]
17 */
18 public function getMethods() {
19 $methods = array();
20 foreach ($this->stmts as $stmt) {
21 if ($stmt instanceof ClassMethod) {
22 $methods[] = $stmt;
23 }
24 }
25 return $methods;
26 }
27
28 /**
29 * Gets method with the given name defined directly in this class/interface/trait.
30 *
31 * @param string $name Name of the method (compared case-insensitively)
32 *
33 * @return ClassMethod|null Method node or null if the method does not exist
34 */
35 public function getMethod($name) {
36 $lowerName = strtolower($name);
37 foreach ($this->stmts as $stmt) {
38 if ($stmt instanceof ClassMethod && $lowerName === strtolower($stmt->name)) {
39 return $stmt;
40 }
41 }
42 return null;
43 }
44 }
45