PHP 클래스 BetterReflection\Reflection\ReflectionClass

상속: implements BetterReflection\Reflection\Reflection
파일 보기 프로젝트 열기: roave/better-reflection 1 사용 예제들

공개 메소드들

메소드 설명
__clone ( )
__toString ( ) : string Get a string representation of this reflection
addMethod ( string $methodName ) Add a new method to the class.
addProperty ( string $propertyName, integer $visibility = ReflectionProperty::IS_PUBLIC, boolean $static = false ) Add a new property to the class.
createFromInstance ( object $instance ) : ReflectionClass Create a ReflectionClass from an instance, using default reflectors etc.
createFromName ( string $className ) : ReflectionClass Create a ReflectionClass by name, using default reflectors etc.
createFromNode ( BetterReflection\Reflector\Reflector $reflector, ClassLike $node, BetterReflection\SourceLocator\Located\LocatedSource $locatedSource, Namespace_ $namespace = null ) : ReflectionClass Create from a Class Node.
export ( string $className = null ) : string Create a reflection and return the string representation of a named class
getAst ( ) : ClassLike Retrieve the AST node for this class
getConstant ( string $name ) : mixed | null Get the value of the specified class constant.
getConstants ( ) : mixed[] Get an array of the defined constants in this class.
getConstructor ( ) : BetterReflection\Reflection\ReflectionMethod Get the constructor method for this class.
getDefaultProperties ( )
getDocComment ( ) : string
getEndLine ( ) : integer Get the line number that this class ends on.
getFileName ( ) : string | null
getImmediateInterfaces ( ) : ReflectionClass[] Get only the interfaces that this class implements (i.e. do not search up parent classes etc.)
getImmediateMethods ( ) : BetterReflection\Reflection\ReflectionMethod[] Get only the methods that this class implements (i.e. do not search up parent classes etc.)
getInterfaceNames ( ) : string[] Gets the interface names.
getInterfaces ( ) : ReflectionClass[] Gets the interfaces.
getLocatedSource ( ) : BetterReflection\SourceLocator\Located\LocatedSource
getMethod ( string $methodName ) : BetterReflection\Reflection\ReflectionMethod Get a single method with the name $methodName.
getMethods ( ) : BetterReflection\Reflection\ReflectionMethod[] Fetch an array of all methods for this class.
getModifiers ( ) : integer Get the core-reflection-compatible modifier values.
getName ( ) : string Get the "full" name of the class (e.g. for A\B\Foo, this will return "A\B\Foo").
getNamespaceName ( ) : string Get the "namespace" name of the class (e.g. for A\B\Foo, this will return "A\B").
getParentClass ( ) : ReflectionClass Get the parent class, if it is defined. If this class does not have a specified parent class, this will throw an exception.
getProperties ( ) : ReflectionProperty[] Get the properties for this class.
getProperty ( string $name ) : ReflectionProperty | null Get the property called $name.
getShortName ( ) : string Get the "short" name of the class (e.g. for A\B\Foo, this will return "Foo").
getStartLine ( ) : integer Get the line number that this class starts on.
getStaticPropertyValue ( string $propertyName ) : mixed Get the value of a static property, if it exists. Throws a PropertyDoesNotExist exception if it does not exist or is not static.
getTraitAliases ( ) : string[] Return a list of the aliases used when importing traits for this class.
getTraitNames ( ) : string[] Get the names of the traits used as an array of strings, if any are defined. If this class does not have any defined traits, this will return an empty array.
getTraits ( ) : ReflectionClass[] Get the traits used, if any are defined. If this class does not have any defined traits, this will return an empty array.
hasConstant ( string $name ) : boolean Does this class have the specified constant?
hasMethod ( string $methodName ) : boolean Does the class have the specified method method?
hasProperty ( string $name ) : boolean Does this class have the specified property?
implementsInterface ( string $interfaceName ) : boolean Checks whether this class implements the given interface.
inNamespace ( ) : boolean Decide if this class is part of a namespace. Returns false if the class is in the global namespace or does not have a specified namespace.
isAbstract ( ) : boolean Is this class an abstract class.
isCloneable ( ) : boolean Checks whether this is a reflection of a class that supports the clone operator
isFinal ( ) : boolean Is this class a final class.
isInstance ( object $object ) : boolean Checks whether the given object is an instance.
isInstantiable ( ) : boolean Checks whether this reflection is an instantiable class
isInterface ( ) : boolean Is this reflection an interface?
isInternal ( ) : boolean Is this an internal class?
isIterateable ( ) : boolean Checks if iterateable
isSubclassOf ( string $className ) : boolean Checks whether the given class string is a subclass of this class.
isTrait ( ) : boolean Is this reflection a trait?
isUserDefined ( ) : boolean Is this a user-defined function (will always return the opposite of whatever isInternal returns).
removeMethod ( string $methodName ) : boolean Remove the named method from the class.
removeProperty ( string $propertyName ) : boolean Remove a property from the class.
setFinal ( boolean $isFinal ) Set whether this class is final or not
setStaticPropertyValue ( string $propertyName, mixed $value ) : void Set the value of a static property

비공개 메소드들

메소드 설명
__construct ( )
getCurrentClassImplementedInterfacesIndexedByName ( ) : ReflectionClass[]
getFqsenFromNamedNode ( Name $node ) : string Given an AST Node\Name, try to resolve the type into a fully qualified structural element name (FQSEN).
getInheritanceClassHierarchy ( ) : ReflectionClass[]
getInterfacesHierarchy ( ) : ReflectionClass[] This method allows us to retrieve all interfaces parent of the this interface. Do not use on class nodes!
getMethodsIndexedByName ( ) : BetterReflection\Reflection\ReflectionMethod[]
reflectClassForNamedNode ( Name $node ) : ReflectionClass Given an AST Node\Name, create a new ReflectionClass for the element.
scanMethods ( ) : BetterReflection\Reflection\ReflectionMethod[] Construct a flat list of methods that are available. This will search up all parent classes/traits/interfaces/current scope for methods.

메소드 상세

__clone() 공개 메소드

public __clone ( )

__toString() 공개 메소드

Get a string representation of this reflection
또한 보기: https://github.com/Roave/BetterReflection/issues/94
public __toString ( ) : string
리턴 string

addMethod() 공개 메소드

Add a new method to the class.
public addMethod ( string $methodName )
$methodName string

addProperty() 공개 메소드

Visibility defaults to \ReflectionProperty::IS_PUBLIC, or can be ::IS_PROTECTED or ::IS_PRIVATE.
public addProperty ( string $propertyName, integer $visibility = ReflectionProperty::IS_PUBLIC, boolean $static = false )
$propertyName string
$visibility integer
$static boolean

createFromInstance() 공개 정적인 메소드

This is simply a helper method that calls ReflectionObject::createFromInstance().
또한 보기: ReflectionObject::createFromInstance
public static createFromInstance ( object $instance ) : ReflectionClass
$instance object
리턴 ReflectionClass

createFromName() 공개 정적인 메소드

Create a ReflectionClass by name, using default reflectors etc.
public static createFromName ( string $className ) : ReflectionClass
$className string
리턴 ReflectionClass

createFromNode() 공개 정적인 메소드

Create from a Class Node.
public static createFromNode ( BetterReflection\Reflector\Reflector $reflector, ClassLike $node, BetterReflection\SourceLocator\Located\LocatedSource $locatedSource, Namespace_ $namespace = null ) : ReflectionClass
$reflector BetterReflection\Reflector\Reflector
$node PhpParser\Node\Stmt\ClassLike
$locatedSource BetterReflection\SourceLocator\Located\LocatedSource
$namespace PhpParser\Node\Stmt\Namespace_ optional - if omitted, we assume it is global namespaced class
리턴 ReflectionClass

export() 공개 정적인 메소드

Create a reflection and return the string representation of a named class
public static export ( string $className = null ) : string
$className string
리턴 string

getAst() 공개 메소드

Retrieve the AST node for this class
public getAst ( ) : ClassLike
리턴 PhpParser\Node\Stmt\ClassLike

getConstant() 공개 메소드

Returns null if not specified.
public getConstant ( string $name ) : mixed | null
$name string
리턴 mixed | null

getConstants() 공개 메소드

Get an array of the defined constants in this class.
public getConstants ( ) : mixed[]
리턴 mixed[]

getConstructor() 공개 메소드

Get the constructor method for this class.
public getConstructor ( ) : BetterReflection\Reflection\ReflectionMethod
리턴 BetterReflection\Reflection\ReflectionMethod

getDefaultProperties() 공개 메소드

getDocComment() 공개 메소드

public getDocComment ( ) : string
리턴 string

getEndLine() 공개 메소드

Get the line number that this class ends on.
public getEndLine ( ) : integer
리턴 integer

getFileName() 공개 메소드

public getFileName ( ) : string | null
리턴 string | null

getImmediateInterfaces() 공개 메소드

Get only the interfaces that this class implements (i.e. do not search up parent classes etc.)
public getImmediateInterfaces ( ) : ReflectionClass[]
리턴 ReflectionClass[]

getImmediateMethods() 공개 메소드

Get only the methods that this class implements (i.e. do not search up parent classes etc.)
public getImmediateMethods ( ) : BetterReflection\Reflection\ReflectionMethod[]
리턴 BetterReflection\Reflection\ReflectionMethod[]

getInterfaceNames() 공개 메소드

Gets the interface names.
public getInterfaceNames ( ) : string[]
리턴 string[] A numerical array with interface names as the values.

getInterfaces() 공개 메소드

Gets the interfaces.
public getInterfaces ( ) : ReflectionClass[]
리턴 ReflectionClass[] An associative array of interfaces, with keys as interface names and the array values as {@see \ReflectionClass} objects.

getLocatedSource() 공개 메소드

public getLocatedSource ( ) : BetterReflection\SourceLocator\Located\LocatedSource
리턴 BetterReflection\SourceLocator\Located\LocatedSource

getMethod() 공개 메소드

Get a single method with the name $methodName.
public getMethod ( string $methodName ) : BetterReflection\Reflection\ReflectionMethod
$methodName string
리턴 BetterReflection\Reflection\ReflectionMethod

getMethods() 공개 메소드

Fetch an array of all methods for this class.
public getMethods ( ) : BetterReflection\Reflection\ReflectionMethod[]
리턴 BetterReflection\Reflection\ReflectionMethod[]

getModifiers() 공개 메소드

Get the core-reflection-compatible modifier values.
public getModifiers ( ) : integer
리턴 integer

getName() 공개 메소드

Get the "full" name of the class (e.g. for A\B\Foo, this will return "A\B\Foo").
public getName ( ) : string
리턴 string

getNamespaceName() 공개 메소드

Get the "namespace" name of the class (e.g. for A\B\Foo, this will return "A\B").
public getNamespaceName ( ) : string
리턴 string

getParentClass() 공개 메소드

You may optionally specify a source locator that will be used to locate the parent class. If no source locator is given, a default will be used.
public getParentClass ( ) : ReflectionClass
리턴 ReflectionClass

getProperties() 공개 메소드

Get the properties for this class.
public getProperties ( ) : ReflectionProperty[]
리턴 ReflectionProperty[]

getProperty() 공개 메소드

Returns null if property does not exist.
public getProperty ( string $name ) : ReflectionProperty | null
$name string
리턴 ReflectionProperty | null

getShortName() 공개 메소드

Get the "short" name of the class (e.g. for A\B\Foo, this will return "Foo").
public getShortName ( ) : string
리턴 string

getStartLine() 공개 메소드

Get the line number that this class starts on.
public getStartLine ( ) : integer
리턴 integer

getStaticPropertyValue() 공개 메소드

(note, differs very slightly from internal reflection behaviour)
public getStaticPropertyValue ( string $propertyName ) : mixed
$propertyName string
리턴 mixed

getTraitAliases() 공개 메소드

The returned array is in key/value pair in this format:. 'aliasedMethodName' => 'ActualClass::actualMethod'
public getTraitAliases ( ) : string[]
리턴 string[]

getTraitNames() 공개 메소드

You may optionally specify a source locator that will be used to locate the traits. If no source locator is given, a default will be used.
public getTraitNames ( ) : string[]
리턴 string[]

getTraits() 공개 메소드

You may optionally specify a source locator that will be used to locate the traits. If no source locator is given, a default will be used.
public getTraits ( ) : ReflectionClass[]
리턴 ReflectionClass[]

hasConstant() 공개 메소드

Does this class have the specified constant?
public hasConstant ( string $name ) : boolean
$name string
리턴 boolean

hasMethod() 공개 메소드

Does the class have the specified method method?
public hasMethod ( string $methodName ) : boolean
$methodName string
리턴 boolean

hasProperty() 공개 메소드

Does this class have the specified property?
public hasProperty ( string $name ) : boolean
$name string
리턴 boolean

implementsInterface() 공개 메소드

Checks whether this class implements the given interface.
public implementsInterface ( string $interfaceName ) : boolean
$interfaceName string
리턴 boolean

inNamespace() 공개 메소드

Decide if this class is part of a namespace. Returns false if the class is in the global namespace or does not have a specified namespace.
public inNamespace ( ) : boolean
리턴 boolean

isAbstract() 공개 메소드

Is this class an abstract class.
public isAbstract ( ) : boolean
리턴 boolean

isCloneable() 공개 메소드

Checks whether this is a reflection of a class that supports the clone operator
public isCloneable ( ) : boolean
리턴 boolean

isFinal() 공개 메소드

Is this class a final class.
public isFinal ( ) : boolean
리턴 boolean

isInstance() 공개 메소드

Checks whether the given object is an instance.
public isInstance ( object $object ) : boolean
$object object
리턴 boolean

isInstantiable() 공개 메소드

Checks whether this reflection is an instantiable class
public isInstantiable ( ) : boolean
리턴 boolean

isInterface() 공개 메소드

Is this reflection an interface?
public isInterface ( ) : boolean
리턴 boolean

isInternal() 공개 메소드

Is this an internal class?
public isInternal ( ) : boolean
리턴 boolean

isIterateable() 공개 메소드

Checks if iterateable
public isIterateable ( ) : boolean
리턴 boolean

isSubclassOf() 공개 메소드

Checks whether the given class string is a subclass of this class.
public isSubclassOf ( string $className ) : boolean
$className string
리턴 boolean

isTrait() 공개 메소드

Is this reflection a trait?
public isTrait ( ) : boolean
리턴 boolean

isUserDefined() 공개 메소드

Is this a user-defined function (will always return the opposite of whatever isInternal returns).
public isUserDefined ( ) : boolean
리턴 boolean

removeMethod() 공개 메소드

Returns true if method was successfully removed. Returns false if method was not found, or could not be removed.
public removeMethod ( string $methodName ) : boolean
$methodName string
리턴 boolean

removeProperty() 공개 메소드

Remove a property from the class.
public removeProperty ( string $propertyName ) : boolean
$propertyName string
리턴 boolean

setFinal() 공개 메소드

Set whether this class is final or not
public setFinal ( boolean $isFinal )
$isFinal boolean

setStaticPropertyValue() 공개 메소드

Set the value of a static property
public setStaticPropertyValue ( string $propertyName, mixed $value ) : void
$propertyName string
$value mixed
리턴 void