1
0
mirror of https://github.com/nikic/PHP-Parser.git synced 2025-05-03 12:07:50 +02:00

added implementations for the new interface methods

This commit is contained in:
Johannes 2012-04-03 13:07:10 -05:00
parent e932711fa4
commit 2ccae143d0

@ -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 */