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 / ClassMethod.php

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

95 lines 3.1 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 use WPDeveloper\BetterDocs\Dependencies\PhpParser\Node\FunctionLike;
7
8 class ClassMethod extends Node\Stmt implements FunctionLike
9 {
10 /** @var int Flags */
11 public $flags;
12 /** @var bool Whether to return by reference */
13 public $byRef;
14 /** @var string Name */
15 public $name;
16 /** @var Node\Param[] Parameters */
17 public $params;
18 /** @var null|string|Node\Name|Node\NullableType Return type */
19 public $returnType;
20 /** @var Node[]|null Statements */
21 public $stmts;
22
23 /** @deprecated Use $flags instead */
24 public $type;
25
26 /**
27 * Constructs a class method node.
28 *
29 * @param string $name Name
30 * @param array $subNodes Array of the following optional subnodes:
31 * 'flags => MODIFIER_PUBLIC: Flags
32 * 'byRef' => false : Whether to return by reference
33 * 'params' => array() : Parameters
34 * 'returnType' => null : Return type
35 * 'stmts' => array() : Statements
36 * @param array $attributes Additional attributes
37 */
38 public function __construct($name, array $subNodes = array(), array $attributes = array()) {
39 parent::__construct($attributes);
40 $this->flags = isset($subNodes['flags']) ? $subNodes['flags']
41 : (isset($subNodes['type']) ? $subNodes['type'] : 0);
42 $this->type = $this->flags;
43 $this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false;
44 $this->name = $name;
45 $this->params = isset($subNodes['params']) ? $subNodes['params'] : array();
46 $this->returnType = isset($subNodes['returnType']) ? $subNodes['returnType'] : null;
47 $this->stmts = array_key_exists('stmts', $subNodes) ? $subNodes['stmts'] : array();
48 }
49
50 public function getSubNodeNames() {
51 return array('flags', 'byRef', 'name', 'params', 'returnType', 'stmts');
52 }
53
54 public function returnsByRef() {
55 return $this->byRef;
56 }
57
58 public function getParams() {
59 return $this->params;
60 }
61
62 public function getReturnType() {
63 return $this->returnType;
64 }
65
66 public function getStmts() {
67 return $this->stmts;
68 }
69
70 public function isPublic() {
71 return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0
72 || ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0;
73 }
74
75 public function isProtected() {
76 return (bool) ($this->flags & Class_::MODIFIER_PROTECTED);
77 }
78
79 public function isPrivate() {
80 return (bool) ($this->flags & Class_::MODIFIER_PRIVATE);
81 }
82
83 public function isAbstract() {
84 return (bool) ($this->flags & Class_::MODIFIER_ABSTRACT);
85 }
86
87 public function isFinal() {
88 return (bool) ($this->flags & Class_::MODIFIER_FINAL);
89 }
90
91 public function isStatic() {
92 return (bool) ($this->flags & Class_::MODIFIER_STATIC);
93 }
94 }
95