| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <sect1 id="zend.server.reflection">
- <title>Zend_Server_Reflection</title>
- <sect2 id="zend.server.reflection.introduction">
- <title>הקדמה</title>
- <para>
- <code>Zend_Server_Reflection</code> מספק מנגנון שליטה ובקרה סטנדרטי לבחינה עצמית של מחלקות ופונצקיות לשימוש במחלקות שרת.
- רכיב זה מבוסס על ה Reflection API של PHP 5, המרחיב אותו בעזרת מתודות להחזרת פרמטרים ותיאורים אודות מחלקות ופונצקיות שונות,
- ורשימה מלאה של כל הפונצקיות.
- </para>
- <para>
- בדרך כלל, ברכיב זה ישתמשו רק מתכנתים אשר משתמשים במחלקות השרת במערכת.
- </para>
- </sect2>
- <sect2 id="zend.server.reflection.usage">
- <title>שימוש</title>
- <para>
- דוגמא לשימוש:
- </para>
- <programlisting role="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> מחזיר אובייקט מסוג
- <code>Zend_Server_Reflection_Function</code> ;
- <code>reflectClass</code> מחזיר אובייקט מסוג
- <code>Zend_Server_Reflection_Class</code>.
- יש לקרוא את הדוקומנטציה כדי לדעת אילו מתודות יש לכל אחד.
- </para>
- </sect2>
- </sect1>
- <!--
- vim:se ts=4 sw=4 et:
- -->
|