&& is the “and” operator: it executes the left-hand command, and if that command is true (i.e. exits with a status of 0) it then executes the right-hand command.
[ "$2" = "" ] tests whether the second parameter to the enclosing function (or script, if used outside a function) is empty. (If there were fewer than two parameters, $2 is empty.)
>$1 is the empty command redirected to the file whose name is the first parameter $1. This creates an empty file if it doesn't exist, and empties the file if it already exists. This command can fail if the script doesn't have the permission to create or modify the file.
return exits the enclosing function.
Thus the meaning of this line is: if $2 is empty, create or truncate the file named $1, and if that succeeds, return from the function.