Methods |
public
|
__construct(string|string[]|self $name, array $attributes = [])
Constructs a name node.
Parameters
$name |
Name as string, part array or Name instance (copy ctor)
|
$attributes |
Additional attributes
|
Overrides
|
#
|
public
|
getSubNodeNames(): array
Gets the names of the sub nodes.
Gets the names of the sub nodes.
Returns
Implements
|
#
|
public
|
getFirst(): string
Gets the first part of the name, i.e. everything before the first namespace separator.
Gets the first part of the name, i.e. everything before the first namespace separator.
Returns
|
#
|
public
|
getLast(): string
Gets the last part of the name, i.e. everything after the last namespace separator.
Gets the last part of the name, i.e. everything after the last namespace separator.
Returns
|
#
|
public
|
isUnqualified(): bool
Checks whether the name is unqualified. (E.g. Name)
Checks whether the name is unqualified. (E.g. Name)
Returns
Whether the name is unqualified
Overriden by
|
#
|
public
|
isQualified(): bool
Checks whether the name is qualified. (E.g. Name\Name)
Checks whether the name is qualified. (E.g. Name\Name)
Returns
Whether the name is qualified
Overriden by
|
#
|
public
|
isFullyQualified(): bool
Checks whether the name is fully qualified. (E.g. \Name)
Checks whether the name is fully qualified. (E.g. \Name)
Returns
Whether the name is fully qualified
Overriden by
|
#
|
public
|
isRelative(): bool
Checks whether the name is explicitly relative to the current namespace. (E.g. namespace\Name)
Checks whether the name is explicitly relative to the current namespace. (E.g. namespace\Name)
Returns
Whether the name is relative
Overriden by
|
#
|
public
|
toString(): string
Returns a string representation of the name itself, without taking the name type into
account (e.g., not including a…
Returns a string representation of the name itself, without taking the name type into
account (e.g., not including a leading backslash for fully qualified names).
Returns
|
#
|
public
|
toCodeString(): string
Returns a string representation of the name as it would occur in code (e.g., including
leading backslash for fully…
Returns a string representation of the name as it would occur in code (e.g., including
leading backslash for fully qualified names.
Returns
Overriden by
|
#
|
public
|
toLowerString(): string
Returns lowercased string representation of the name, without taking the name type into
account (e.g., no leading…
Returns lowercased string representation of the name, without taking the name type into
account (e.g., no leading backslash for fully qualified names).
Returns
Lowercased string representation
|
#
|
public
|
isSpecialClassName(): bool
Checks whether the identifier is a special class name (self, parent or static).
Checks whether the identifier is a special class name (self, parent or static).
Returns
Whether identifier is a special class name
|
#
|
public
|
__toString(): string
Returns a string representation of the name by imploding the namespace parts with the
namespace separator.
Returns a string representation of the name by imploding the namespace parts with the
namespace separator.
Returns
|
#
|
public
|
slice(int $offset, int|null $length = null): static|null
Gets a slice of a name (similar to array_slice).
Gets a slice of a name (similar to array_slice).
This method returns a new instance of the same type as the original and with the same
attributes.
If the slice is empty, null is returned. The null value will be correctly handled in
concatenations using concat().
Offset and length have the same meaning as in array_slice().
Parameters
$offset |
Offset to start the slice at (may be negative)
|
$length |
Length of the slice (may be negative)
|
Returns
|
#
|
public
static
|
concat(string|string[]|self|null $name1, string|string[]|self|null $name2, array $attributes = []): static|null
Concatenate two names, yielding a new Name instance.
Concatenate two names, yielding a new Name instance.
The type of the generated instance depends on which class this method is called on, for
example Name\FullyQualified::concat() will yield a Name\FullyQualified instance.
If one of the arguments is null, a new instance of the other name will be returned. If both
arguments are null, null will be returned. As such, writing
Name::concat($namespace, $shortName)
where $namespace is a Name node or null will work as expected.
Parameters
$name1 |
The first name
|
$name2 |
The second name
|
$attributes |
Attributes to assign to concatenated name
|
Returns
|
#
|
public
|
getType(): string
Gets the type of the node.
Gets the type of the node.
Returns
Overriden by
Implements
|
#
|