Index: trunk/phase3/includes/Init.php |
— | — | @@ -153,6 +153,27 @@ |
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
| 157 | + * Determine wether a method exists within a class, using a method which works |
| 158 | + * under HipHop. |
| 159 | + * |
| 160 | + * Note that under HipHop when method_exists is given a string for it's class |
| 161 | + * such as to test for a static method has the same issues as class_exists does. |
| 162 | + * |
| 163 | + * @param $class string |
| 164 | + * @param $method string |
| 165 | + * |
| 166 | + * @return bool |
| 167 | + */ |
| 168 | + static function methodExists( $class, $method ) { |
| 169 | + try { |
| 170 | + $r = new ReflectionMethod( $class, $method ); |
| 171 | + } catch( ReflectionException $r ) { |
| 172 | + $r = false; |
| 173 | + } |
| 174 | + return $r !== false; |
| 175 | + } |
| 176 | + |
| 177 | + /** |
157 | 178 | * Determine whether a function exists, using a method which works under |
158 | 179 | * HipHop. |
159 | 180 | * |