PHP 클래스 PhpParser\Node\Name

상속: extends PhpParser\NodeAbstract
파일 보기 프로젝트 열기: nikic/php-parser 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$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