public function generateCode()
    {
        $refClass = new ReflectionClass($this->className);
        $this->finalClassesCanNotBeMocked($refClass);

        $this->methods = array();
        $this->makeAllAbstractMethodsThrowException($refClass);
        if (!$this->niceMock || $refClass->isInterface()) {
            $this->makeAllMethodsThrowException($refClass);
        }
        $this->renderRules();
        $this->renderConstructor();
        $this->renderClone();
        $this->exposeMethods();
        $this->setUpGetCallsForMethod();

        $code = $this->getNamespaceCode();
        $methods = implode("\n", $this->methods);
        $superWord = $this->getSuperWord($refClass);

        $class = "class {$this->getMockName()} $superWord \\{$this->className}";
        if ('implements' === $superWord) {
            $class .= ', ';
        } else {
            $class .= ' implements ';
        }
        $class .= '\Concise\Mock\MockInterface';

        return $code .
        "$class { public static \$_methodCalls = array(); $methods }";
    }