Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / lib / simpletestlib / reflection_php4.php
bloba624106fb9996547f3871c7d4aa8a1a8df1375c8
1 <?php
2 /**
3 * base include file for SimpleTest
4 * @package SimpleTest
5 * @subpackage UnitTester
6 * @version $Id$
7 */
9 /**
10 * Version specific reflection API.
11 * @package SimpleTest
12 * @subpackage UnitTester
14 class SimpleReflection {
15 var $_interface;
17 /**
18 * Stashes the class/interface.
19 * @param string $interface Class or interface
20 * to inspect.
22 function SimpleReflection($interface) {
23 $this->_interface = $interface;
26 /**
27 * Checks that a class has been declared.
28 * @return boolean True if defined.
29 * @access public
31 function classExists() {
32 return class_exists($this->_interface);
35 /**
36 * Needed to kill the autoload feature in PHP5
37 * for classes created dynamically.
38 * @return boolean True if defined.
39 * @access public
41 function classExistsSansAutoload() {
42 return class_exists($this->_interface);
45 /**
46 * Checks that a class or interface has been
47 * declared.
48 * @return boolean True if defined.
49 * @access public
51 function classOrInterfaceExists() {
52 return class_exists($this->_interface);
55 /**
56 * Needed to kill the autoload feature in PHP5
57 * for classes created dynamically.
58 * @return boolean True if defined.
59 * @access public
61 function classOrInterfaceExistsSansAutoload() {
62 return class_exists($this->_interface);
65 /**
66 * Gets the list of methods on a class or
67 * interface.
68 * @returns array List of method names.
69 * @access public
71 function getMethods() {
72 return get_class_methods($this->_interface);
75 /**
76 * Gets the list of interfaces from a class. If the
77 * class name is actually an interface then just that
78 * interface is returned.
79 * @returns array List of interfaces.
80 * @access public
82 function getInterfaces() {
83 return array();
86 /**
87 * Finds the parent class name.
88 * @returns string Parent class name.
89 * @access public
91 function getParent() {
92 return strtolower(get_parent_class($this->_interface));
95 /**
96 * Determines if the class is abstract, which for PHP 4
97 * will never be the case.
98 * @returns boolean True if abstract.
99 * @access public
101 function isAbstract() {
102 return false;
106 * Gets the source code matching the declaration
107 * of a method.
108 * @param string $method Method name.
109 * @access public
111 function getSignature($method) {
112 return "function &$method()";