PHP Класс PhpParser\Node\Name

Наследование: extends PhpParser\NodeAbstract
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$parts Parts of the name

Открытые методы

Метод Описание
__construct ( string | array | self $name, array $attributes = [] ) Constructs a name node.
__toString ( ) : string Returns a string representation of the name by imploding the namespace parts with the namespace separator.
concat ( string | array | self | null $name1, string | array | self | null $name2, array $attributes = [] ) : static | null Concatenate two names, yielding a new Name instance.
getFirst ( ) : string Gets the first part of the name, i.e. everything before the first namespace separator.
getLast ( ) : string Gets the last part of the name, i.e. everything after the last namespace separator.
getSubNodeNames ( )
isFullyQualified ( ) : boolean Checks whether the name is fully qualified. (E.g. \Name)
isQualified ( ) : boolean Checks whether the name is qualified. (E.g. Name\Name)
isRelative ( ) : boolean Checks whether the name is explicitly relative to the current namespace. (E.g. namespace\Name)
isUnqualified ( ) : boolean Checks whether the name is unqualified. (E.g. Name)
slice ( integer $offset, integer | null $length = null ) : static | null Gets a slice of a name (similar to array_slice).
toString ( ) : string Returns a string representation of the name by imploding the namespace parts with the namespace separator.

Приватные методы

Метод Описание
prepareName ( string | array | self $name ) : array Prepares a (string, array or Name node) name for use in name changing methods by converting it to an array.

Описание методов

__construct() публичный Метод

Constructs a name node.
public __construct ( string | array | self $name, array $attributes = [] )
$name string | array | self Name as string, part array or Name instance (copy ctor)
$attributes array Additional attributes

__toString() публичный Метод

Returns a string representation of the name by imploding the namespace parts with the namespace separator.
public __toString ( ) : string
Результат string String representation

concat() публичный статический Метод

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.
public static concat ( string | array | self | null $name1, string | array | self | null $name2, array $attributes = [] ) : static | null
$name1 string | array | self | null The first name
$name2 string | array | self | null The second name
$attributes array Attributes to assign to concatenated name
Результат static | null Concatenated name

getFirst() публичный Метод

Gets the first part of the name, i.e. everything before the first namespace separator.
public getFirst ( ) : string
Результат string First part of the name

getLast() публичный Метод

Gets the last part of the name, i.e. everything after the last namespace separator.
public getLast ( ) : string
Результат string Last part of the name

getSubNodeNames() публичный Метод

public getSubNodeNames ( )

isFullyQualified() публичный Метод

Checks whether the name is fully qualified. (E.g. \Name)
public isFullyQualified ( ) : boolean
Результат boolean Whether the name is fully qualified

isQualified() публичный Метод

Checks whether the name is qualified. (E.g. Name\Name)
public isQualified ( ) : boolean
Результат boolean Whether the name is qualified

isRelative() публичный Метод

Checks whether the name is explicitly relative to the current namespace. (E.g. namespace\Name)
public isRelative ( ) : boolean
Результат boolean Whether the name is relative

isUnqualified() публичный Метод

Checks whether the name is unqualified. (E.g. Name)
public isUnqualified ( ) : boolean
Результат boolean Whether the name is unqualified

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().
public slice ( integer $offset, integer | null $length = null ) : static | null
$offset integer Offset to start the slice at (may be negative)
$length integer | null Length of the slice (may be negative)
Результат static | null Sliced name

toString() публичный Метод

Returns a string representation of the name by imploding the namespace parts with the namespace separator.
public toString ( ) : string
Результат string String representation

Описание свойств

$parts публичное свойство

Parts of the name
Устаревший: Avoid directly accessing $parts, use methods instead.
public $parts