public function get()
    {
        $compiler = new ClassCompiler(
            $this->className,
            $this->niceMock,
            $this->constructorArgs,
            $this->disableConstructor,
            $this->disableClone
        );
        if ($this->customClassName) {
            $compiler->setCustomClassName($this->customClassName);
        }
        $compiler->setRules($this->rules);
        foreach ($this->expose as $method) {
            $compiler->addExpose($method);
        }
        $mockInstance = $compiler->newInstance();
        $this->testCase->addMockInstance($this, $mockInstance);
        $this->restoreState($mockInstance);

        foreach ($this->properties as $name => $value) {
            $this->testCase->setProperty($mockInstance, $name, $value);
        }

        return $mockInstance;
    }