From 2ccae143d0859e4b03e70d12e34b3180daeeedcc Mon Sep 17 00:00:00 2001 From: Johannes Date: Tue, 3 Apr 2012 13:07:10 -0500 Subject: [PATCH] added implementations for the new interface methods --- lib/PHPParser/NodeAbstract.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) 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 */