public function __construct($options = [])
{
$defaults = ['name' => '', 'type' => 'namespace', 'parent' => null];
$options += $defaults;
$this->_parent = $options['parent'];
$this->_type = $options['type'];
if (!$this->_parent) {
$this->_name = $options['name'];
return;
}
$pname = $this->_parent->name();
switch ($this->_type) {
case 'namespace':
case 'function':
case 'trait':
case 'class':
$this->_name = $pname ? $pname . $options['name'] : $options['name'];
break;
case 'method':
$this->_name = $pname ? $pname . '::' . $options['name'] : $options['name'];
break;
}
}