mock_objects.php
protected function createCodeForClass($methods)
    {
        $implements = '';        
        $interfaces = $this->reflection->getInterfaces();

        // exclude interfaces
        $interfaces = array_diff($interfaces, ['Traversable', 'Throwable']);

        if (count($interfaces) > 0) {
            $implements = 'implements ' . implode(', ', $interfaces);
        }

        $code = 'class ' . $this->mock_class . ' extends ' . $this->mock_base . ' ' . $implements . " {\n";
        $code .= "    function __construct() {\n";
        $code .= "        parent::__construct();\n";
        $code .= "    }\n";
        $code .= $this->createCodeForConstructor();
        $code .= $this->createCodeForMethods($methods);
        $code .= "}\n";

        // TODO Reminder, uncomment to see the code of the generated Mock object.
        //if($this->mock_class === 'MockDummyInterface') {
        //    var_dump($code);
        //}

        return $code;
    }
protected function createCodeForClass($methods)
    {
        $implements = '';        
        $interfaces = $this->reflection->getInterfaces();

        // exclude interfaces
        $interfaces = array_diff($interfaces, ['Traversable', 'Throwable']);

        if (count($interfaces) > 0) {
            $implements = 'implements ' . implode(', ', $interfaces);
        }

        $code = 'class ' . $this->mock_class . ' extends ' . $this->mock_base . ' ' . $implements . " {\n";
        $code .= "    function __construct() {\n";
        $code .= "        parent::__construct();\n";
        $code .= "    }\n";
        $code .= $this->createCodeForConstructor();
        $code .= $this->createCodeForMethods($methods);
        $code .= "}\n";

        // TODO Reminder, uncomment to see the code of the generated Mock object.
        //if($this->mock_class === 'MockDummyInterface') {
        //    var_dump($code);
        //}

        return $code;
    }
The new mock class code as a string.

@param array $methods Additional methods.

@return string Code for new mock class.