| Conditions | 7 | 
| Paths | 6 | 
| Total Lines | 55 | 
| Code Lines | 36 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 58 | public function onMessage($msgData, $message)  | 
            ||
| 59 |     { | 
            ||
| 60 | $channelID = (int) $msgData['message']['channelID'];  | 
            ||
| 61 | |||
| 62 | if (in_array($channelID, $this->excludeChannel, true))  | 
            ||
| 63 |         { | 
            ||
| 64 | return null;  | 
            ||
| 65 | }  | 
            ||
| 66 | |||
| 67 | $this->message = $message;  | 
            ||
| 68 | |||
| 69 | $message = $msgData['message']['message'];  | 
            ||
| 70 | $user = $msgData['message']['from'];  | 
            ||
| 71 | |||
| 72 | $data = command($message, $this->information()['trigger'], $this->config['bot']['trigger']);  | 
            ||
| 73 |         if (isset($data['trigger'])) { | 
            ||
| 74 | $messageString = $data['messageString'];  | 
            ||
| 75 | $cleanString = urlencode($messageString);  | 
            ||
| 76 | $corpID = corpID($cleanString);  | 
            ||
| 77 | |||
| 78 |             if (empty($corpID)) { | 
            ||
| 79 |                 return $this->message->reply('**Error:** Unable to find any group matching that name.'); | 
            ||
| 80 | }  | 
            ||
| 81 | |||
| 82 | $corporation = corpDetails($corpID);  | 
            ||
| 83 |             if (null === $corporation) { | 
            ||
| 84 |                 return $this->message->reply('**Error:** ESI is down. Try again later.'); | 
            ||
| 85 | }  | 
            ||
| 86 | $corporationName = $corporation['corporation_name'];  | 
            ||
| 87 | $allianceID = $corporation['alliance_id'];  | 
            ||
| 88 | $allianceName = allianceName($allianceID);  | 
            ||
| 89 | $ceoID = $corporation['ceo_id'];  | 
            ||
| 90 | $ceoName = characterName($ceoID);  | 
            ||
| 91 | $memberCount = $corporation['member_count'];  | 
            ||
| 92 | $corpTicker = $corporation['ticker'];  | 
            ||
| 93 |             $url = "https://zkillboard.com/corporation/{$corpID}/"; | 
            ||
| 94 | |||
| 95 |             if ($corporationName === null || $corporationName === '') { | 
            ||
| 96 |                 return $this->message->reply('**Error:** No corporation found.'); | 
            ||
| 97 | }  | 
            ||
| 98 | |||
| 99 | |||
| 100 |             $msg = "```Corp Name: {$corporationName} | 
            ||
| 101 | Corp Ticker: {$corpTicker} | 
            ||
| 102 | CEO: {$ceoName} | 
            ||
| 103 | Alliance Name: {$allianceName} | 
            ||
| 104 | Member Count: {$memberCount} | 
            ||
| 105 | ```  | 
            ||
| 106 | For more info, visit: $url";  | 
            ||
| 107 | |||
| 108 |             $this->logger->addInfo("corpInfo: Sending corp info to {$user}"); | 
            ||
| 109 | $this->message->reply($msg);  | 
            ||
| 110 | }  | 
            ||
| 111 | return null;  | 
            ||
| 112 | }  | 
            ||
| 113 | |||
| 126 | 
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.