1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-12-04 02:07:59 +01:00
PHP-Parser/lib/PhpParser/Node/Stmt/ClassLike.php
Tom Rochette 1366e833a1 Move getMethods() to new ClassLike node
Class_, Interface_ and Trait_ extend the ClassLike node, which
provides the getMethods() method.
2015-01-31 22:59:38 +01:00

24 lines
462 B
PHP

<?php
namespace PhpParser\Node\Stmt;
use PhpParser\Node;
/**
* Class, interface or trait.
*
* @property string $name Name
* @property Node[] $stmts Statements
*/
abstract class ClassLike extends Node\Stmt {
public function getMethods() {
$methods = array();
foreach ($this->stmts as $stmt) {
if ($stmt instanceof ClassMethod) {
$methods[] = $stmt;
}
}
return $methods;
}
}