mock_objects.php
protected function extendClassCode($methods)
    {
        $code  = 'class ' . $this->mock_class . ' extends ' . $this->class . " {\n";
        $code .= "    protected \$mock;\n";
        $code .= $this->addMethodList($methods);
        $code .= "\n";

        $code .= "    function __construct() {\n";
        $code .= '        $this->mock = new ' . $this->mock_base . "();\n";
        $code .= "        \$this->mock->disableExpectationNameChecks();\n";
        $code .= "    }\n";
        $code .= $this->createCodeForConstructor();
        $code .= $this->chainMockReturns();
        $code .= $this->chainMockExpectations();
        $code .= $this->chainThrowMethods();
        $code .= $this->createCodeForOverridenMethods($methods);
        $code .= "}\n";

        return $code;
    }
protected function extendClassCode($methods)
    {
        $code  = 'class ' . $this->mock_class . ' extends ' . $this->class . " {\n";
        $code .= "    protected \$mock;\n";
        $code .= $this->addMethodList($methods);
        $code .= "\n";

        $code .= "    function __construct() {\n";
        $code .= '        $this->mock = new ' . $this->mock_base . "();\n";
        $code .= "        \$this->mock->disableExpectationNameChecks();\n";
        $code .= "    }\n";
        $code .= $this->createCodeForConstructor();
        $code .= $this->chainMockReturns();
        $code .= $this->chainMockExpectations();
        $code .= $this->chainThrowMethods();
        $code .= $this->createCodeForOverridenMethods($methods);
        $code .= "}\n";

        return $code;
    }
The extension class code as a string.
The class composites a mock object and chains mocked methods to it.

@param array $methods Mocked methods.

@return string Code for a new class.