Class Reflection

Feature / Methods PHP5 Reflect

class reports information about a class

ReflectionClass

Bartlett\Reflect\Model\ClassModel

__construct - Constructs a ReflectionClass

__toString - Returns the string representation of the ReflectionClass object

export - Exports a class

getConstant - Gets defined constant

getConstants - Gets constants

getConstructor - Gets the constructor of the class

getDefaultProperties - Gets default properties

getDocComment - Gets doc comments

getEndLine - Gets end line

getExtension - Gets a ReflectionExtension object for the extension which defined the class

getExtensionName - Gets the name of the extension which defined the class

getFileName - Gets the filename of the file in which the class has been defined

getInterfaceNames - Gets the interface names

getInterfaces - Gets the interfaces

getMethod - Gets a ReflectionMethod for a class method

getMethods - Gets an array of methods

getModifiers - Gets modifiers

getName - Gets class name

getNamespaceName - Gets namespace name

getParentClass - Gets parent class

getProperties - Gets properties

getProperty - Gets a ReflectionProperty for a class’s property

getShortName - Gets short name

getStartLine - Gets starting line number

getStaticProperties - Gets static properties

getStaticPropertyValue - Gets static property value

getTraitAliases - Returns an array of trait aliases

getTraitNames - Returns an array of names of traits used by this class

getTraits - Returns an array of traits used by this class

hasConstant - Checks if constant is defined

hasMethod - Checks if method is defined

hasProperty - Checks if property is defined

implementsInterface - Implements interface

inNamespace - Checks if class in namespace

isAbstract - Checks if class is abstract

isCloneable - Returns whether this class is cloneable

isFinal - Checks if class is final

isInstance - Checks class for instance

isInstantiable - Checks if the class is instantiable

isInterface - Checks if the class is an interface

isInternal - Checks if class is defined internally by an extension, or the core

isIterateable - Checks if iterateable

isSubclassOf - Checks if a subclass

isTrait - Returns whether this is a trait

isUserDefined - Checks if user defined

newInstance - Creates a new class instance from given arguments

newInstanceArgs - Creates a new class instance from given arguments

newInstanceWithoutConstructor - Creates a new class instance without invoking the constructor

setStaticPropertyValue - Sets static property value

Constant Reflection

Warning This class does not exist in PHP5 Reflection API
Feature / Methods Reflect

class reports information about a constant

Bartlett\Reflect\Model\ConstantModel

__construct - Constructs a Reflection Constant

__toString - Returns the string representation of the Reflection Constant object

getDocComment - Gets doc comments

getExtension - Gets a ReflectionExtension object for the extension which defined the constant

getExtensionName - Gets the name of the extension which defined the constant

getFileName - Gets the filename of the file in which the constant has been defined

getName - Gets constant name

getNamespaceName - Gets namespace name

getShortName - Gets short name

getValue - Gets value

inNamespace - Checks if in namespace

isInternal - Checks if constant is defined internally by an extension, or the core

isMagic - Checks whether it’s a magic constant

Function Reflection

Feature / Methods PHP5 Reflect

class reports information about a function

ReflectionFunction

Bartlett\Reflect\Model\FunctionModel

__construct - Constructs a ReflectionFunction

__toString - Returns the string representation of the ReflectionFunction object

export - Exports a function

getClosure - Returns a dynamically created closure for the function

invoke - Invokes function

invokeArgs - Invokes function with args

isDisabled - Checks if function is disabled

Function Abstract Reflection

Feature / Methods PHP5 Reflect

A parent class to ReflectionFunction

ReflectionFunctionAbstract

Bartlett\Reflect\Model\AbstractFunctionModel

__clone - Clones function

getClosureScopeClass - Returns the scope associated to the closure

getClosureThis - Returns this pointer bound to closure

getDocComment - Gets doc comments

getEndLine - Gets end line

getExtension - Gets a ReflectionExtension object for the extension which defined the function

getExtensionName - Gets the name of the extension which defined the function

getFileName - Gets the filename of the file in which the function has been defined

getName - Gets function name

getNamespaceName - Gets namespace name

getNumberOfParameters - Gets number of parameters

getNumberOfRequiredParameters - Gets number of required parameters

getParameters - Gets parameters

getShortName - Gets function short name

getStartLine - Gets starting line number

getStaticVariables - Gets static variables

inNamespace - Checks if function in namespace

isClosure - Checks if closure

isDeprecated - Checks if function deprecated

isGenerator - Returns whether this function is a generator

isInternal - Checks if function is defined internally by an extension, or the core

isUserDefined - Checks if user defined

returnsReference - Checks if returns reference

Method Reflection

Feature / Methods PHP5 Reflect

class reports information about a function

ReflectionMethod

Bartlett\Reflect\Model\MethodModel

__construct - Constructs a ReflectionMethod

__toString - Returns the string representation of the ReflectionMethod object

export - Exports a method

getClosure - Returns a dynamically created closure for the method

getDeclaringClass - Gets declaring class for the reflected method

getModifiers - Gets the method modifiers

getPrototype - Gets the method prototype

invoke - Invokes method

invokeArgs - Invokes method with args

isAbstract - Checks if method is abstract

isConstructor - Checks if method is a constructor

isDestructor - Checks if method is a destructor

isFinal - Checks if method is final

isPrivate - Checks if method is private

isProtected - Checks if method is protected

isPublic - Checks if method is public

isStatic - Checks if method is static

setAccessible - Set method accessibility

Parameter Reflection

Feature / Methods PHP5 Reflect

class reports information about a parameter

ReflectionParameter

Bartlett\Reflect\Model\ParameterModel

__construct - Constructs a ReflectionParameter

__toString - Returns the string representation of the ReflectionParameter object

__clone - Clones parameter

allowsNull - Checks if null is allowed

canBePassedByValue - Returns whether this parameter can be passed by value

export - Exports a parameter

getClass - Gets class

getDeclaringClass - Gets declaring class for the reflected parameter

getDeclaringFunction - Gets declaring function for the reflected parameter

getDefaultValue - Gets default parameter value

getDefaultValueConstantName - Returns the default value’s constant name if default value is constant or null

getName - Gets parameter name

getPosition - Gets parameter position

isArray - Checks if parameter expects an array

isCallable - Returns whether parameter MUST be callable

isDefaultValueAvailable - Checks if a default value is available

isDefaultValueConstant - Returns whether the default value of this parameter is constant

isOptional - Checks if the parameter is optional

isPassedByReference - Checks if the parameter is passed in by reference

Property Reflection

Feature / Methods PHP5 Reflect

class reports information about classes properties

ReflectionProperty

Bartlett\Reflect\Model\PropertyModel

__construct - Constructs a ReflectionProperty

__toString - Returns the string representation of the ReflectionProperty object

__clone - Clones property

export - Exports a property

getDeclaringClass - Gets declaring class for the reflected property

getDocComment - Gets doc comments from a property

getModifiers - Gets modifiers

getName - Gets property name

getValue - Gets property value

isDefault - Checks if default value

isPrivate - Checks if property is private

isProtected - Checks if property is protected

isPublic - Checks if property is public

isStatic - Checks if property is static

setAccessible - Set property accessibility

setValue - Set property value