private function createTempFile($name, $content)
    {
        $tempDir  = \sys_get_temp_dir();
        $fileName = \md5($name);
        $filePath = $tempDir . DIRECTORY_SEPARATOR . 'phpcq-author-validation' . DIRECTORY_SEPARATOR . $fileName;

        if (\file_exists($filePath)) {
            return $filePath;
        }

        if (!\file_exists(\dirname($filePath)) && !\mkdir($concurrentDirectory = \dirname($filePath))
            && !is_dir(
                $concurrentDirectory
            )) {
            throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory));
        }

        $file = \fopen($filePath, 'wb');

        \fwrite($file, $content);

        return $filePath;
    }