public function replaceMethod($methodName, $newCode)
    {
        if ($methodCode = $this->findMethod($methodName)) {
            $this->code = str_replace($methodCode, $newCode, $this->code);
            $this->knownMethodCache[$methodName] = $newCode;

            return $methodCode;
        }

        return false;
    }
public function replaceMethod($methodName, $newCode)
    {
        if ($methodCode = $this->findMethod($methodName)) {
            $this->code = str_replace($methodCode, $newCode, $this->code);
            $this->knownMethodCache[$methodName] = $newCode;

            return $methodCode;
        }

        return false;
    }
public function replaceMethod ( $ methodName , $ newCode ) { if ( $ methodCode = $ this -> findMethod ( $ methodName ) ) { $ this -> code = str_replace ( $ methodCode , $ newCode , $ this -> code ) ; $ this -> knownMethodCache [ $ methodName ] = $ newCode ; return $ methodCode ; } return false ; }
Parse the code looking for a method definition, and replaces the code if found

@param string $methodName The name of the method to find, e.g. 'getAuthor'
@param string $newCode    The code to use in place of the old method definition

@return mixed false if not found, or the method code string if found
Parse the code looking for a method definition and replaces the code if found