3 * base include file for SimpleTest
5 * @subpackage UnitTester
6 * @version $Id: reflection_php4.php,v 1.9 2005/11/22 02:07:32 lastcraft Exp $
10 * Version specific reflection API.
12 * @subpackage UnitTester
14 class SimpleReflection
{
18 * Stashes the class/interface.
19 * @param string $interface Class or interface
22 function SimpleReflection($interface) {
23 $this->_interface
= $interface;
27 * Checks that a class has been declared.
28 * @return boolean True if defined.
31 function classExists() {
32 return class_exists($this->_interface
);
36 * Needed to kill the autoload feature in PHP5
37 * for classes created dynamically.
38 * @return boolean True if defined.
41 function classExistsSansAutoload() {
42 return class_exists($this->_interface
);
46 * Checks that a class or interface has been
48 * @return boolean True if defined.
51 function classOrInterfaceExists() {
52 return class_exists($this->_interface
);
56 * Needed to kill the autoload feature in PHP5
57 * for classes created dynamically.
58 * @return boolean True if defined.
61 function classOrInterfaceExistsSansAutoload() {
62 return class_exists($this->_interface
);
66 * Gets the list of methods on a class or
68 * @returns array List of method names.
71 function getMethods() {
72 return get_class_methods($this->_interface
);
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.
82 function getInterfaces() {
87 * Finds the parent class name.
88 * @returns string Parent class name.
91 function getParent() {
92 return strtolower(get_parent_class($this->_interface
));
96 * Determines if the class is abstract, which for PHP 4
97 * will never be the case.
98 * @returns boolean True if abstract.
101 function isAbstract() {
106 * Gets the source code matching the declaration
108 * @param string $method Method name.
111 function getSignature($method) {
112 return "function &$method()";