public function createClassDefinitionFile(IntercessionClass $class, $file)
    {
        $dir = dirname($file);

        if (!file_exists($dir)) {
            set_error_handler(function() use ($dir) {
                throw new NotWritableException($dir);
            });
            mkdir($dir);
            restore_error_handler();
        }

        if (!is_writable($dir)) {
            throw new NotWritableException($dir);
        }

        touch($file);

        file_put_contents($file, $this->renderClass($class));
    }