Marlinc/IRCBot — Issue #1: shortFunctions.php should be refactored
Author: Snicksie
Created: 2011-12-06 08:16:24+00:00
State: open

https://github.com/Marlinc/IRCBot/blob/master/shortFunctions.php is not correctly refactored, there's too much duplicate code. I suggest this:
```
## Original

if (!$botId) {
$botId = botId();
}
$bot = IRCBot_Application::getInstance()->getBotHandler()
->getBotById($botId);
if ($bot) {

## Suggestion

function getValidBotById($botId)
{
if (!$botId) {
$botId = botId();
}
return IRCBot_Application::getInstance()->getBotHandler()
->getBotById($botId);
}

// in functions:

$bot = getValidBotById($botId);
if($bot)
//blabla
```