public function createFileInTemporaryDirectory($relativePath, callable $callback)
    {
        $result = false;
        $absolutePath = GeneralUtility::getFileAbsFileName($relativePath);

        if (false === $this->fileExists($absolutePath)) {
            $content = call_user_func($callback);

            $result = $this->writeTemporaryFile($absolutePath, $content);

            if (null !== $result) {
                throw FileCreationFailedException::fileCreationFailed($absolutePath, $result);
            }
        }

        return $result;
    }