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;
    }
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;
    }
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 ; }
This function will check if the file at the given path exists. If it does
not, the callback is called to get the content of the file, which is put
in the created file.

A boolean is returned: if the file did not exist, and it was created
without error, `true` is returned. Otherwise, `false` is returned.

@param string   $relativePath
@param callable $callback
@return bool
@throws FileCreationFailedException
This function will check if the file at the given path exists . If it does not the callback is called to get the content of the file which is put in the created file .