trait ClassReflectionAnalyserTrait

Class ClassReflectionAnalyserTrait.

Methods

$this
setReflectionClass( ReflectionClass $reflectionClass = null)

Set the current reflection class to operate on (can be overridden by directly passing a reflection class to any of the has[Trait|Method|Property] methods.

$this
setReflectionClassFromClassName( string $class)

Create and set the reflection class via a class name.

$this
setReflectionClassFromClassInstance( object $class)

Create and set the reflection class via a class instance.

getReflectionClass()

No description

$this
unsetReflectionClass()

Un-sets the current reflection class associated with object.

$this
setRequireFQN( bool $requireFQN = true)

Enables ability to allow unsafe checks against trait names without passing a fully-qualified namespace.

bool
getRequireFQN()

Returns whether the FQN is required or not.

bool
hasTrait( string $traitName, ReflectionClass $class = null, bool $recursiveSearch = true)

Return true if the given object has the provided trait.

bool
hasMethod( string $methodName, ReflectionClass $class = null)

Returns true if the given object has the given method.

bool
hasProperty( string $propertyName, ReflectionClass $class = null, bool $recursiveSearch = true)

Returns true if the given object has the given property.

getProperties( int|bool $filter = \ReflectionProperty::IS_PUBLIC)

No description

array
getPropertiesPublic()

Get an array of the class's public properties.

array
getPropertiesProtected()

Get an array of the class's protected properties.

array
getPropertiesPrivate()

Get an array of the class's private properties.

ReflectionProperty.
setPropertyPublic( string $property, ReflectionClass $class = null)

Set a protected/private property as public.

ReflectionMethod.
setMethodPublic( string $method, ReflectionClass $class = null)

Set a protected/private method as public.

Details

at line line 47
$this setReflectionClass( ReflectionClass $reflectionClass = null)

Set the current reflection class to operate on (can be overridden by directly passing a reflection class to any of the has[Trait|Method|Property] methods.

Parameters

ReflectionClass $reflectionClass

Return Value

$this

at line line 61
$this setReflectionClassFromClassName( string $class)

Create and set the reflection class via a class name.

Parameters

string $class

Return Value

$this

at line line 75
$this setReflectionClassFromClassInstance( object $class)

Create and set the reflection class via a class instance.

Parameters

object $class

Return Value

$this

at line line 85
null|ReflectionClass getReflectionClass()

Return Value

null|ReflectionClass

at line line 95
$this unsetReflectionClass()

Un-sets the current reflection class associated with object.

Return Value

$this

at line line 110
$this setRequireFQN( bool $requireFQN = true)

Enables ability to allow unsafe checks against trait names without passing a fully-qualified namespace.

Use at your own risk...

Parameters

bool $requireFQN

Return Value

$this

at line line 120
bool getRequireFQN()

Returns whether the FQN is required or not.

Return Value

bool

at line line 134
bool hasTrait( string $traitName, ReflectionClass $class = null, bool $recursiveSearch = true)

Return true if the given object has the provided trait.

Parameters

string $traitName
ReflectionClass $class
bool $recursiveSearch

Return Value

bool

at line line 159
bool hasMethod( string $methodName, ReflectionClass $class = null)

Returns true if the given object has the given method.

Parameters

string $methodName
ReflectionClass $class

Return Value

bool

at line line 179
bool hasProperty( string $propertyName, ReflectionClass $class = null, bool $recursiveSearch = true)

Returns true if the given object has the given property.

Parameters

string $propertyName
ReflectionClass $class
bool $recursiveSearch

Return Value

bool

at line line 203
ReflectionProperty[] getProperties( int|bool $filter = \ReflectionProperty::IS_PUBLIC)

Parameters

int|bool $filter

Return Value

ReflectionProperty[]

Exceptions

InvalidArgumentException If argument type is not false or a \ReflectionProperty filter.

at line line 228
array getPropertiesPublic()

Get an array of the class's public properties.

Return Value

array

at line line 240
array getPropertiesProtected()

Get an array of the class's protected properties.

Return Value

array

at line line 252
array getPropertiesPrivate()

Get an array of the class's private properties.

Return Value

array

at line line 267
ReflectionProperty. setPropertyPublic( string $property, ReflectionClass $class = null)

Set a protected/private property as public.

Parameters

string $property
ReflectionClass $class

Return Value

ReflectionProperty.

at line line 291
ReflectionMethod. setMethodPublic( string $method, ReflectionClass $class = null)

Set a protected/private method as public.

Parameters

string $method
ReflectionClass $class

Return Value

ReflectionMethod.