Introduction

Zend_Server_Reflection

Introduction

Zend_Server_Reflection provides a standard mechanism for performing function and class introspection for use with server classes. It is based on PHP 5's Reflection API, augmenting it with methods for retrieving parameter and return value types and descriptions, a full list of function and method prototypes (i.e., all possible valid calling combinations), and function or method descriptions.

Typically, this functionality will only be used by developers of server classes for the framework.

Usage

Basic usage is simple:

  1. span style="color: #ff0000;">'My_Class''my_function');
  2.  
  3. // Get prototypes
  4. $prototypes = $reflection->getPrototypes();
  5.  
  6. // Loop through each prototype for the function
  7. // Get prototype return type
  8. "Return type: ""\n";
  9.  
  10.     // Get prototype parameters
  11. "Parameters: \n"// Get parameter type
  12. "    ""\n";
  13.     }
  14. }
  15.  
  16. // Get namespace for a class, function, or method.
  17. // Namespaces may be set at instantiation time (second argument), or using
  18. // setNamespace()
  19. $reflection->getNamespace();

reflectFunction() returns a Zend_Server_Reflection_Function object; reflectClass() returns a Zend_Server_Reflection_Class object. Please refer to the API documentation to see what methods are available to each.


Introduction