diff --git a/lib/PHPParser/NodeAbstract.php b/lib/PHPParser/NodeAbstract.php index b7c911a0..2732b704 100644 --- a/lib/PHPParser/NodeAbstract.php +++ b/lib/PHPParser/NodeAbstract.php @@ -5,6 +5,7 @@ abstract class PHPParser_NodeAbstract implements PHPParser_Node, IteratorAggrega protected $subNodes; protected $line; protected $docComment; + protected $attributes; /** * Creates a Node. @@ -17,6 +18,7 @@ abstract class PHPParser_NodeAbstract implements PHPParser_Node, IteratorAggrega $this->subNodes = $subNodes; $this->line = $line; $this->docComment = $docComment; + $this->attributes = array(); } /** @@ -72,6 +74,34 @@ abstract class PHPParser_NodeAbstract implements PHPParser_Node, IteratorAggrega public function setDocComment($docComment) { $this->docComment = $docComment; } + + /** + * @inheritDoc + */ + public function setAttribute($key, $value) { + $this->attributes[$key] = $value; + } + + /** + * @inheritDoc + */ + public function hasAttribute($key) { + return array_key_exists($key, $this->attributes); + } + + /** + * @inheritDoc + */ + public function getAttribute($key, $default = null) { + return array_key_exists($key, $this->attributes) ? $this->attributes[$key] : $default; + } + + /** + * @inheritDoc + */ + public function getAttributes() { + return $this->attributes; + } /* Magic interfaces */