[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/tests_runner/lib/simpletest/ -> reflection_php4.php (source)

   1  <?php
   2  /**

   3   *    base include file for SimpleTest

   4   *    @package    SimpleTest

   5   *    @subpackage    UnitTester

   6   *    @version    $Id: reflection_php4.php 5999 2007-06-18 13:13:08Z pachanga $

   7   */
   8  
   9  /**

  10   *    Version specific reflection API.

  11   *    @package SimpleTest

  12   *    @subpackage UnitTester

  13   *    @ignore    duplicate with reflection_php5.php

  14   */
  15  class SimpleReflection {
  16      var $_interface;
  17  
  18      /**

  19       *    Stashes the class/interface.

  20       *    @param string $interface    Class or interface

  21       *                                to inspect.

  22       */
  23  	function SimpleReflection($interface) {
  24          $this->_interface = $interface;
  25      }
  26  
  27      /**

  28       *    Checks that a class has been declared.

  29       *    @return boolean        True if defined.

  30       *    @access public

  31       */
  32  	function classExists() {
  33          return class_exists($this->_interface);
  34      }
  35  
  36      /**

  37       *    Needed to kill the autoload feature in PHP5

  38       *    for classes created dynamically.

  39       *    @return boolean        True if defined.

  40       *    @access public

  41       */
  42  	function classExistsSansAutoload() {
  43          return class_exists($this->_interface);
  44      }
  45  
  46      /**

  47       *    Checks that a class or interface has been

  48       *    declared.

  49       *    @return boolean        True if defined.

  50       *    @access public

  51       */
  52  	function classOrInterfaceExists() {
  53          return class_exists($this->_interface);
  54      }
  55  
  56      /**

  57       *    Needed to kill the autoload feature in PHP5

  58       *    for classes created dynamically.

  59       *    @return boolean        True if defined.

  60       *    @access public

  61       */
  62  	function classOrInterfaceExistsSansAutoload() {
  63          return class_exists($this->_interface);
  64      }
  65  
  66      /**

  67       *    Gets the list of methods on a class or

  68       *    interface.

  69       *    @returns array          List of method names.

  70       *    @access public

  71       */
  72  	function getMethods() {
  73          return get_class_methods($this->_interface);
  74      }
  75  
  76      /**

  77       *    Gets the list of interfaces from a class. If the

  78       *      class name is actually an interface then just that

  79       *      interface is returned.

  80       *    @returns array          List of interfaces.

  81       *    @access public

  82       */
  83  	function getInterfaces() {
  84          return array();
  85      }
  86  
  87      /**

  88       *    Finds the parent class name.

  89       *    @returns string      Parent class name.

  90       *    @access public

  91       */
  92  	function getParent() {
  93          return strtolower(get_parent_class($this->_interface));
  94      }
  95  
  96      /**

  97       *    Determines if the class is abstract, which for PHP 4

  98       *    will never be the case.

  99       *    @returns boolean      True if abstract.

 100       *    @access public

 101       */
 102  	function isAbstract() {
 103          return false;
 104      }
 105  
 106      /**

 107       *    Determines if the the entity is an interface, which for PHP 4

 108       *    will never be the case.

 109       *    @returns boolean      True if interface.

 110       *    @access public

 111       */
 112  	function isInterface() {
 113          return false;
 114      }
 115          
 116      /**

 117       *      Scans for final methods, but as it's PHP 4 there

 118       *      aren't any.

 119       *    @returns boolean   True if the class has a final method.

 120       *    @access public

 121       */
 122  	function hasFinal() {
 123          return false;
 124      }
 125  
 126      /**

 127       *      Gets the source code matching the declaration

 128       *      of a method.

 129       *       @param string $method          Method name.

 130       *    @access public

 131       */
 132  	function getSignature($method) {
 133          return "function &$method()";
 134      }
 135  }
 136  ?>


Generated: Sat Nov 22 03:48:54 2008 Cross-referenced by PHPXref 0.7