/** * Creates code within a class to generate replaced * methods. All methods call the _invoke() handler * with the method name and the arguments in an * array. * @param string $class Class to clone. * @param string $base Base mock/stub class with methods that * cannot be cloned. Otherwise you * would be stubbing the accessors used * to set the stubs. * @param array $methods Additional methods. * @static * @access private */ function _createHandlerCode($class, $base, $methods) { $code = ""; $methods = array_merge($methods, get_class_methods($class)); foreach ($methods as $method) { if (Stub::_isSpecialMethod($method)) { continue; } if (in_array($method, get_class_methods($base))) { continue; } $code .= " function &{$method}() {\n"; $code .= " \$args = func_get_args();\n"; $code .= " return \$this->_invoke(\"{$method}\", \$args);\n"; $code .= " }\n"; } return $code; }