[ Index ] |
|
Code source de PRADO 3.0.6 |
1 <?php 2 /** 3 * base include file for SimpleTest 4 * @package SimpleTest 5 * @subpackage UnitTester 6 * @version $Id: reflection_php4.php 1397 2006-09-07 07:55:53Z wei $ 7 */ 8 9 /** 10 * Version specific reflection API. 11 * @package SimpleTest 12 * @subpackage UnitTester 13 */ 14 class SimpleReflection { 15 protected $_interface; 16 17 /** 18 * Stashes the class/interface. 19 * @param string $interface Class or interface 20 * to inspect. 21 */ 22 function SimpleReflection($interface) { 23 $this->_interface = $interface; 24 } 25 26 /** 27 * Checks that a class has been declared. 28 * @return boolean True if defined. 29 * @access public 30 */ 31 function classExists() { 32 return class_exists($this->_interface); 33 } 34 35 /** 36 * Needed to kill the autoload feature in PHP5 37 * for classes created dynamically. 38 * @return boolean True if defined. 39 * @access public 40 */ 41 function classExistsSansAutoload() { 42 return class_exists($this->_interface); 43 } 44 45 /** 46 * Checks that a class or interface has been 47 * declared. 48 * @return boolean True if defined. 49 * @access public 50 */ 51 function classOrInterfaceExists() { 52 return class_exists($this->_interface); 53 } 54 55 /** 56 * Needed to kill the autoload feature in PHP5 57 * for classes created dynamically. 58 * @return boolean True if defined. 59 * @access public 60 */ 61 function classOrInterfaceExistsSansAutoload() { 62 return class_exists($this->_interface); 63 } 64 65 /** 66 * Gets the list of methods on a class or 67 * interface. 68 * @returns array List of method names. 69 * @access public 70 */ 71 function getMethods() { 72 return get_class_methods($this->_interface); 73 } 74 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 81 */ 82 function getInterfaces() { 83 return array(); 84 } 85 86 /** 87 * Finds the parent class name. 88 * @returns string Parent class name. 89 * @access public 90 */ 91 function getParent() { 92 return strtolower(get_parent_class($this->_interface)); 93 } 94 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 100 */ 101 function isAbstract() { 102 return false; 103 } 104 105 /** 106 * Gets the source code matching the declaration 107 * of a method. 108 * @param string $method Method name. 109 * @access public 110 */ 111 function getSignature($method) { 112 return "function $method()"; 113 } 114 } 115 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 21:07:04 2007 | par Balluche grâce à PHPXref 0.7 |