<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect1 id="zend.server.reflection">
    <title>Zend_Server_Reflection</title>

    <sect2 id="zend.server.reflection.introduction">
        <title>Introduction</title>

        <para>
            <classname>Zend_Server_Reflection</classname> 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/method descriptions.
        </para>
        <para>
            Typically, this functionality will only be used by developers of
            server classes for the framework.
        </para>
    </sect2>
    <sect2 id="zend.server.reflection.usage">
        <title>Usage</title>

        <para>
            Basic usage is simple:
        </para>

        <programlisting language="php"><![CDATA[
$class    = Zend_Server_Reflection::reflectClass('My_Class');
$function = Zend_Server_Reflection::reflectFunction('my_function');

// Get prototypes
$prototypes = $reflection->getPrototypes();

// Loop through each prototype for the function
foreach ($prototypes as $prototype) {

    // Get prototype return type
    echo "Return type: ", $prototype->getReturnType(), "\n";

    // Get prototype parameters
    $parameters = $prototype->getParameters();

    echo "Parameters: \n";
    foreach ($parameters as $parameter) {
        // Get parameter type
        echo "    ", $parameter->getType(), "\n";
    }
}

// Get namespace for a class, function, or method.
// Namespaces may be set at instantiation time (second argument), or using
// setNamespace()
$reflection->getNamespace();
]]></programlisting>

        <para>
            <code>reflectFunction()</code> returns a
            <classname>Zend_Server_Reflection_Function</classname> object;
            <code>reflectClass</code> returns a
            <classname>Zend_Server_Reflection_Class</classname> object. Please refer to
            the API documentation to see what methods are available to each.
        </para>
    </sect2>
</sect1>
<!--
vim:se ts=4 sw=4 et:
-->
