Zend_Server_Reflection.xml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <sect1 id="zend.server.reflection">
  2. <title>Zend_Server_Reflection</title>
  3. <sect2 id="zend.server.reflection.introduction">
  4. <title>הקדמה</title>
  5. <para>
  6. <code>Zend_Server_Reflection</code> מספק מנגנון שליטה ובקרה סטנדרטי לבחינה עצמית של מחלקות ופונצקיות לשימוש במחלקות שרת.
  7. רכיב זה מבוסס על ה Reflection API של PHP 5, המרחיב אותו בעזרת מתודות להחזרת פרמטרים ותיאורים אודות מחלקות ופונצקיות שונות,
  8. ורשימה מלאה של כל הפונצקיות.
  9. </para>
  10. <para>
  11. בדרך כלל, ברכיב זה ישתמשו רק מתכנתים אשר משתמשים במחלקות השרת במערכת.
  12. </para>
  13. </sect2>
  14. <sect2 id="zend.server.reflection.usage">
  15. <title>שימוש</title>
  16. <para>
  17. דוגמא לשימוש:
  18. </para>
  19. <programlisting role="php"><![CDATA[
  20. $class = Zend_Server_Reflection::reflectClass('My_Class');
  21. $function = Zend_Server_Reflection::reflectFunction('my_function');
  22. // Get prototypes
  23. $prototypes = $reflection->getPrototypes();
  24. // Loop through each prototype for the function
  25. foreach ($prototypes as $prototype) {
  26. // Get prototype return type
  27. echo "Return type: ", $prototype->getReturnType(), "\n";
  28. // Get prototype parameters
  29. $parameters = $prototype->getParameters();
  30. echo "Parameters: \n";
  31. foreach ($parameters as $parameter) {
  32. // Get parameter type
  33. echo " ", $parameter->getType(), "\n";
  34. }
  35. }
  36. // Get namespace for a class, function, or method.
  37. // Namespaces may be set at instantiation time (second argument), or using
  38. // setNamespace()
  39. $reflection->getNamespace();
  40. ]]>
  41. </programlisting>
  42. <para>
  43. <code>reflectFunction()</code> מחזיר אובייקט מסוג
  44. <code>Zend_Server_Reflection_Function</code> ;
  45. <code>reflectClass</code> מחזיר אובייקט מסוג
  46. <code>Zend_Server_Reflection_Class</code>.
  47. יש לקרוא את הדוקומנטציה כדי לדעת אילו מתודות יש לכל אחד.
  48. </para>
  49. </sect2>
  50. </sect1>
  51. <!--
  52. vim:se ts=4 sw=4 et:
  53. -->