It's to avoid fatal errors due to redeclaration of functions. If you have a function called 'foo' declared somewhere else, when trying to redeclare it, the script will produce a fatal error. By implementing this check, if the function is already declared, the script will continue, but you won't see the new function at work, since it will not be declared.
I would also add:
```
} else {
log_message('error', 'The \'foo\' function was declared previously');
}
```