| 1 | <?php |
||
| 7 | abstract class ClassLike extends Node\Stmt { |
||
| 8 | /** @var string 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) { |
||
| 44 | } |
||
| 45 |