2011-04-18 19:02:30 +02:00
|
|
|
<?php
|
|
|
|
|
2011-05-27 18:20:44 +02:00
|
|
|
/**
|
|
|
|
* @property array $parts Parts of the name
|
|
|
|
*/
|
2011-06-05 18:40:04 +02:00
|
|
|
class PHPParser_Node_Name extends PHPParser_NodeAbstract
|
2011-04-18 19:02:30 +02:00
|
|
|
{
|
|
|
|
const ABSOLUTE = 1;
|
|
|
|
const RELATIVE = 2;
|
|
|
|
|
|
|
|
protected $resolveType;
|
|
|
|
|
|
|
|
public function resolveType($type) {
|
|
|
|
$this->resolveType = $type;
|
|
|
|
}
|
2011-08-04 12:02:14 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the last part of the name, i.e. everything after the last namespace separator.
|
|
|
|
*
|
|
|
|
* @return string Last part of the name
|
|
|
|
*/
|
|
|
|
public function getLast() {
|
|
|
|
return $this->parts[count($this->parts) - 1];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a string representation of the name by imploding the namespace parts with a separator.
|
|
|
|
*
|
|
|
|
* @param string $separator The separator to use (defaults to the namespace separator \)
|
|
|
|
*
|
|
|
|
* @return string String representation
|
|
|
|
*/
|
|
|
|
public function toString($separator = '\\') {
|
|
|
|
return implode($separator, $this->parts);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a string representation of the name by imploding the namespace parts with the
|
|
|
|
* namespace separator \ (backslash).
|
|
|
|
*
|
|
|
|
* @return string String representation
|
|
|
|
*/
|
|
|
|
public function __toString() {
|
|
|
|
return $this->toString('\\');
|
|
|
|
}
|
2011-04-18 19:02:30 +02:00
|
|
|
}
|