Skip to content

classes_reflection_wdfreflector.class

Daniel Spors edited this page Dec 19, 2023 · 3 revisions

Classes in file reflection/wdfreflector.class.php

class WdfReflector

Wraps ReflectionClass and provides additional functionality regarding Attributes and DocComments This is central class as it ensures correct DocComment parsing even if a bytecode cache (like APC) is active and removing them. There's also intensive caching active to improve speed.

Extends: ReflectionClass

CreateObject

Creates a new object of the reflected type Will call the constructor for the reflected type like this:

return $this->newInstanceArgs($args);	

Definition: public function CreateObject($args)

Returns: object The new instance

Parameters:

  • array $args Constructor arguments

GetClassAttributes

Returns class attributes. Class attributes are DocComment parts following the syntax @attribute[<Attribute>]. @ := The @ sign. <Attribute> := Construction string of the attribute. May miss the part 'Attribute' at the end and empty brackets. Exapmples:

@attribute[Right]	
@attribute[RightAttribute]	
@attribute[Right()]	
@attribute[RightAttribute()]	
@attribute[Right('false')]	
@attribute[RightAttribute('true || false')]	

Definition: public function GetClassAttributes($filter, $allowAttrInheritance=true)

Returns: array An array of objects derivered from WdfAttribute.

Parameters:

  • array|string $filter Return only Attributes tha match the given filter. May be string for a single attribute or array of string for multiple attributes.

  • bool $allowAttrInheritance If true, filter not only matches directly, but also all classes derivered from a valid filter

getCommentObject

Returns the DocComment for a method(or the class) as object This is the modern version of WdfReflector::getCommentString().

Definition: public function getCommentObject($method_name=false)

Returns: PhpDocComment The DocComment wrapped as PhpDocComment

Parameters:

  • string $method_name Name of method or false if you want the class comment

getCommentString

Returns the DocComment for a method Perhaps use WdfReflector::getCommentObject() instead as that one returns a PhpDocComment object.

Definition: public function getCommentString($method_name=false)

Returns: string The DocComment

Parameters:

  • string $method_name Name of method

GetInstance

Create a WdfReflector instance Return a reflector for the given classname or object.

Definition: public static function GetInstance($classname)

Returns: WdfReflector A new instance of type WdfReflector

Parameters:

  • object|string $classname Classname or object to be reflected

getMethod

Overrides ReflectionClass::getMethod to enable WdfReflectionMethod handling.

Definition: public function getMethod($name)

Returns: WdfReflectionMethod|null A WdfReflectionMethod instance or false on error

Parameters:

  • string $name Name of the method to get

GetMethodAttributes

Returns method attributes. For a detailed description see WdfReflector::GetClassAttributes

Definition: public function GetMethodAttributes($method_name, $filter, $allowAttrInheritance=true)

Returns: array An array of objects derivered from WdfAttribute.

Parameters:

  • string $method_name The name of the method.

  • array|string $filter Return only Attributes tha match the given filter. May be string for a single attribute or array of string for multiple attributes.

  • bool $allowAttrInheritance If true, filter not only matches directly, but also all classes derivered from a valid filter

GetPropertyNames

Returns a list of property names May also step down inheritance graph and include properties from there

Definition: public function GetPropertyNames($include_derivered=true)

Returns: array An array of property names

Parameters:

  • bool $include_derivered If true steps down inheritance graph
Clone this wiki locally