Passed
Pull Request — master (#8)
by Bob
03:01
created
src/plugins/onMessage/charInfo.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,6 @@
 block discarded – undo
24 24
  */
25 25
 
26 26
 use Discord\Discord;
27
-use Discord\Parts\Channel\Message;
28 27
 
29 28
 /**
30 29
  * @property  message
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
                 return $this->message->reply('**Error:** no data available');
99 99
             }
100 100
             // Get stats
101
-            $statsURL = 'https://beta.eve-kill.net/api/charInfo/characterID/'.urlencode($characterID).'/';
101
+            $statsURL = 'https://beta.eve-kill.net/api/charInfo/characterID/' . urlencode($characterID) . '/';
102 102
             $stats = json_decode(downloadData($statsURL), true);
103 103
 
104 104
             if (empty($stats)) {
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             $ePeenSize = @$stats['ePeenSize'];
128 128
             $facepalms = @$stats['facepalms'];
129 129
             $lastUpdated = @$stats['lastUpdatedOnBackend'];
130
-            $url = 'https://beta.eve-kill.net/character/'.$stats['characterID'].'/';
130
+            $url = 'https://beta.eve-kill.net/character/' . $stats['characterID'] . '/';
131 131
 
132 132
 
133 133
             $msg = "```characterName: {$characterName}
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
     {
164 164
         return [
165 165
             'name'        => 'char',
166
-            'trigger'     => [$this->config['bot']['trigger'].'char'],
166
+            'trigger'     => [$this->config['bot']['trigger'] . 'char'],
167 167
             'information' => 'Returns basic EVE Online data about a character from projectRena. To use simply type !char character_name',
168 168
         ];
169 169
     }
Please login to merge, or discard this patch.
src/plugins/onTick/notifications.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,6 @@
 block discarded – undo
24 24
  */
25 25
 
26 26
 
27
-use Discord\Discord;
28 27
 use Discord\Parts\Channel\Message;
29 28
 use Discord\Parts\Channel\Channel;
30 29
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 
433 433
             $this->logger->addInfo("Next Notification Check At: {$cacheTimer} EVE Time");
434 434
         } catch (Exception $e) {
435
-            $this->logger->addInfo('Notification Error: '.$e->getMessage());
435
+            $this->logger->addInfo('Notification Error: ' . $e->getMessage());
436 436
         }
437 437
     }
438 438
 
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
                 break;
481 481
         }
482 482
 
483
-        return json_decode(downloadData($downloadFrom.$typeID.'/'), true);
483
+        return json_decode(downloadData($downloadFrom . $typeID . '/'), true);
484 484
     }
485 485
 
486 486
     /**
Please login to merge, or discard this patch.
src/plugins/onTick/twitterOutput.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,6 @@
 block discarded – undo
23 23
  * SOFTWARE.
24 24
  */
25 25
 
26
-use Discord\Discord;
27
-use Discord\Parts\Channel\Message;
28 26
 use Discord\Parts\Channel\Channel;
29 27
 
30 28
 /**
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 
106 106
                     $this->maxID = max($id, $this->maxID);
107 107
 
108
-                    $url = 'https://twitter.com/'.$screenName[0].'/status/'.$id;
109
-                    $message = ['message' => $text[0], 'postedAt' => $createdAt[0], 'postedBy' => $postedBy[0], 'screenName' => $screenName[0], 'url' => $url.$id[0]];
110
-                    $msg = '**@'.$screenName[0].'** ('.$message['postedBy'].') / '.htmlspecialchars_decode($message['message']);
108
+                    $url = 'https://twitter.com/' . $screenName[0] . '/status/' . $id;
109
+                    $message = ['message' => $text[0], 'postedAt' => $createdAt[0], 'postedBy' => $postedBy[0], 'screenName' => $screenName[0], 'url' => $url . $id[0]];
110
+                    $msg = '**@' . $screenName[0] . '** (' . $message['postedBy'] . ') / ' . htmlspecialchars_decode($message['message']);
111 111
                     $messages[$id] = $msg;
112 112
 
113 113
                     $continue = true;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      */
143 143
     public function shortenUrl($url)
144 144
     {
145
-        return file_get_contents('http://is.gd/api.php?longurl='.$url);
145
+        return file_get_contents('http://is.gd/api.php?longurl=' . $url);
146 146
     }
147 147
 
148 148
     /**
Please login to merge, or discard this patch.
src/lib/Db.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
  */
25 25
 
26 26
 /**
27
- * @param null $db
27
+ * @param string|null $db
28 28
  * @return null|PDO
29 29
  */
30 30
 function openDB($db = null)
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@
 block discarded – undo
31 31
 function openDB($db = null)
32 32
 {
33 33
     if ($db == null) {
34
-        $db = __DIR__.'/../../database/dramiel.sqlite';
34
+        $db = __DIR__ . '/../../database/dramiel.sqlite';
35 35
     }
36 36
     if ($db == 'ccp') {
37
-        $db = __DIR__.'/../../database/ccpData.sqlite';
37
+        $db = __DIR__ . '/../../database/ccpData.sqlite';
38 38
     }
39 39
 
40 40
     $dsn = "sqlite:$db";
Please login to merge, or discard this patch.
src/plugins/onTick/evemails.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,6 @@
 block discarded – undo
23 23
  * SOFTWARE.
24 24
  */
25 25
 
26
-use Discord\Discord;
27
-use Discord\Parts\Channel\Message;
28 26
 use Discord\Parts\Channel\Channel;
29 27
 
30 28
 /**
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@
 block discarded – undo
153 153
                 $sentBy = $mail['senderName'];
154 154
                 $title = $mail['title'];
155 155
                 $sentDate = $mail['sentDate'];
156
-                $url = "https://api.eveonline.com/char/MailBodies.xml.aspx?keyID={$keyID}&vCode={$vCode}&characterID={$characterID}&ids=".$mail['messageID'];
156
+                $url = "https://api.eveonline.com/char/MailBodies.xml.aspx?keyID={$keyID}&vCode={$vCode}&characterID={$characterID}&ids=" . $mail['messageID'];
157 157
                 $content = strip_tags(str_replace('<br>', "\n", json_decode(json_encode(simplexml_load_string(downloadData($url), 'SimpleXMLElement', LIBXML_NOCDATA)))->result->rowset->row));
158 158
 
159 159
                 // Blank Content Check
Please login to merge, or discard this patch.
src/plugins/onTick/fileReader.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,6 @@
 block discarded – undo
24 24
  */
25 25
 
26 26
 
27
-use Discord\Discord;
28 27
 use Discord\Parts\Channel\Message;
29 28
 use Discord\Parts\Channel\Channel;
30 29
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
                         continue;
99 99
                     }
100 100
 
101
-                    $message .= $row.' | ';
101
+                    $message .= $row . ' | ';
102 102
                     usleep(300000);
103 103
                 }
104 104
 
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
 
108 108
                 foreach ($this->channelConfig as $chanName => $chanConfig) {
109 109
                     if ($chanConfig['searchString'] == false) { // If no match was found, and searchString is false, just use that
110
-                        $message = $chanConfig['textStringPrepend'].' '.$message.' '.$chanConfig['textStringAppend'];
110
+                        $message = $chanConfig['textStringPrepend'] . ' ' . $message . ' ' . $chanConfig['textStringAppend'];
111 111
                         $channelID = $chanConfig['channelID'];
112 112
                     } elseif (stristr($message, $chanConfig['searchString'])) {
113
-                        $message = $chanConfig['textStringPrepend'].' '.$message.' '.$chanConfig['textStringAppend'];
113
+                        $message = $chanConfig['textStringPrepend'] . ' ' . $message . ' ' . $chanConfig['textStringAppend'];
114 114
                         $channelID = $chanConfig['channelID'];
115 115
                     }
116 116
                 }
Please login to merge, or discard this patch.
Dramiel.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,6 @@  discard block
 block discarded – undo
28 28
 
29 29
 // Setup logger
30 30
 use Discord\Discord;
31
-use Discord\Parts\Channel\Channel;
32 31
 
33 32
 // More memory allowance
34 33
 ini_set('memory_limit', '1024M');
@@ -67,7 +66,6 @@  discard block
 block discarded – undo
67 66
 updateCCPData($logger);
68 67
 
69 68
 // Init Discord
70
-use Discord\Parts\Channel\Message;
71 69
 use Discord\Parts\User\Game;
72 70
 use Discord\WebSockets\Event;
73 71
 use Discord\WebSockets\WebSocket;
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  */
25 25
 
26 26
 // Require the vendor stuff
27
-require_once __DIR__.'/vendor/autoload.php';
27
+require_once __DIR__ . '/vendor/autoload.php';
28 28
 
29 29
 // Setup logger
30 30
 use Discord\Discord;
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 // create a log channel
46 46
 $logger = new Logger('Dramiel');
47
-$logger->pushHandler(new StreamHandler(__DIR__.'/log/dramielLog.log', Logger::DEBUG));
47
+$logger->pushHandler(new StreamHandler(__DIR__ . '/log/dramielLog.log', Logger::DEBUG));
48 48
 $logger->addInfo('Logger Initiated');
49 49
 
50 50
 global $logger;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 }
59 59
 
60 60
 // Load the library files (Probably a prettier way to do this that i haven't thought up yet)
61
-foreach (glob(__DIR__.'/src/lib/*.php') as $lib) {
61
+foreach (glob(__DIR__ . '/src/lib/*.php') as $lib) {
62 62
     require_once $lib;
63 63
 }
64 64
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     }
96 96
 }
97 97
 // Number of plugins loaded
98
-$logger->info('Loaded: '.count($pluginsT).' background plugins');
98
+$logger->info('Loaded: ' . count($pluginsT) . ' background plugins');
99 99
 
100 100
 // Load chat plugins
101 101
 $pluginDirs = ['src/plugins/onMessage/*.php'];
@@ -117,47 +117,47 @@  discard block
 block discarded – undo
117 117
 }
118 118
 
119 119
 // Number of chat plugins loaded
120
-$logger->addInfo('Loaded: '.count($plugins).' chat plugins');
120
+$logger->addInfo('Loaded: ' . count($plugins) . ' chat plugins');
121 121
 
122 122
 $ws = new WebSocket($discord);
123 123
 
124 124
 $ws->on(
125 125
     'ready',
126
-    function ($discord) use ($ws, $logger, $config, $plugins, $pluginsT) {
126
+    function($discord) use ($ws, $logger, $config, $plugins, $pluginsT) {
127 127
         // In here we can access any of the WebSocket events.
128 128
         //
129 129
         // There is a list of event constants that you can
130 130
         // find here: https://teamreflex.github.io/DiscordPHP/classes/Discord.WebSockets.Event.html
131 131
         //
132 132
         // We will echo to the console that the WebSocket is ready.
133
-        $logger->addInfo('Discord WebSocket is ready!'.PHP_EOL);
133
+        $logger->addInfo('Discord WebSocket is ready!' . PHP_EOL);
134 134
         $game = new Game(['name' => $config['bot']['game'], 'url' => null, 'type' => null], true);
135 135
         $ws->updatePresence($game, false);
136 136
         // $ws->setNickname($config["bot"]["name"]); //not in yet
137 137
 
138 138
         // Database check
139
-        $ws->loop->addPeriodicTimer(86400, function () use ($logger) {
139
+        $ws->loop->addPeriodicTimer(86400, function() use ($logger) {
140 140
             updateDramielDB($logger);
141 141
             updateCCPData($logger);
142 142
         });
143 143
 
144 144
         // Run the Tick plugins
145
-        $ws->loop->addPeriodicTimer(1, function () use ($pluginsT) {
145
+        $ws->loop->addPeriodicTimer(1, function() use ($pluginsT) {
146 146
             foreach ($pluginsT as $plugin) {
147 147
                 $plugin->tick();
148 148
             }
149 149
         });
150 150
 
151 151
         // Mem cleanup every 30 minutes
152
-        $ws->loop->addPeriodicTimer(1800, function () use ($logger) {
153
-            $logger->addInfo('Memory in use: '.memory_get_usage() / 1024 / 1024 .'MB');
152
+        $ws->loop->addPeriodicTimer(1800, function() use ($logger) {
153
+            $logger->addInfo('Memory in use: ' . memory_get_usage() / 1024 / 1024 . 'MB');
154 154
             gc_collect_cycles(); // Collect garbage
155
-            $logger->addInfo('Memory in use after garbage collection: '.memory_get_usage() / 1024 / 1024 .'MB');
155
+            $logger->addInfo('Memory in use after garbage collection: ' . memory_get_usage() / 1024 / 1024 . 'MB');
156 156
         });
157 157
 
158 158
         $ws->on(
159 159
             Event::MESSAGE_CREATE,
160
-            function ($message, $discord, $newdiscord) use ($logger, $config, $plugins) {
160
+            function($message, $discord, $newdiscord) use ($logger, $config, $plugins) {
161 161
                 $msgData = [
162 162
                     'message' => [
163 163
                         'timestamp'         => $message->timestamp,
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
                             try {
187 187
                                 $plugin->onMessage($msgData, $message);
188 188
                             } catch (Exception $e) {
189
-                                $logger->addError('Error: '.$e->getMessage());
189
+                                $logger->addError('Error: ' . $e->getMessage());
190 190
                             }
191 191
                         }
192 192
                     }
@@ -197,19 +197,19 @@  discard block
 block discarded – undo
197 197
 );
198 198
 $ws->on(
199 199
     'error',
200
-    function ($error, $ws) use ($logger) {
200
+    function($error, $ws) use ($logger) {
201 201
         $logger->addError($error);
202 202
         exit(1);
203 203
     }
204 204
 );
205 205
 $ws->on(
206 206
     'reconnecting',
207
-    function () use ($logger) {
207
+    function() use ($logger) {
208 208
         $logger->addInfo('Websocket is reconnecting..');
209 209
     });
210 210
 $ws->on(
211 211
     'reconnected',
212
-    function () use ($logger) {
212
+    function() use ($logger) {
213 213
         $logger->addInfo('Websocket was reconnected..');
214 214
     });
215 215
 // Now we will run the ReactPHP Event Loop!
Please login to merge, or discard this patch.
src/plugins/onMessage/about.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,6 @@
 block discarded – undo
23 23
  * SOFTWARE.
24 24
  */
25 25
 
26
-use Discord\Discord;
27
-use Discord\Parts\Channel\Message;
28 26
 use Discord\Parts\Channel\Channel;
29 27
 
30 28
 /**
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
             $msg = '```
100 100
 Developer: Shibdib (In-game Name: Mr Twinkie)
101 101
 
102
-Current Version: '.$gitRevision['short'].'
103
-Current Branch: '.$gitBranch."
102
+Current Version: '.$gitRevision['short'] . '
103
+Current Branch: '.$gitBranch . "
104 104
 Github Repo: https://github.com/shibdib/Dramiel
105 105
 
106 106
 Statistics:
107 107
 Currently on {$this->info['guilds']} different discord servers.
108
-Up-time: ".$interval->y.' Year(s), '.$interval->m.' Month(s), '.$interval->d.' Days, '.$interval->h.' Hours, '.$interval->i.' Minutes, '.$interval->s.' seconds.
109
-Memory Usage: ~'.round(memory_get_usage() / 1024 / 1024, 3).'MB```';
108
+Up-time: " . $interval->y . ' Year(s), ' . $interval->m . ' Month(s), ' . $interval->d . ' Days, ' . $interval->h . ' Hours, ' . $interval->i . ' Minutes, ' . $interval->s . ' seconds.
109
+Memory Usage: ~'.round(memory_get_usage() / 1024 / 1024, 3) . 'MB```';
110 110
             $this->logger->addInfo("Sending about info to {$user}");
111 111
             $this->message->reply($msg);
112 112
         }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     {
120 120
         return [
121 121
             'name'        => 'about',
122
-            'trigger'     => [$this->config['bot']['trigger'].'about'],
122
+            'trigger'     => [$this->config['bot']['trigger'] . 'about'],
123 123
             'information' => "Shows information on the bot, who created it, what library it's using, revision, and other stats. Example: !about",
124 124
         ];
125 125
     }
Please login to merge, or discard this patch.
src/plugins/onMessage/auth.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,6 @@
 block discarded – undo
23 23
  * SOFTWARE.
24 24
  */
25 25
 
26
-use Discord\Discord;
27
-use Discord\Parts\Channel\Message;
28 26
 use Discord\Parts\Channel\Channel;
29 27
 
30 28
 /**
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             $result = selectPending($this->db, $this->dbUser, $this->dbPass, $this->dbName, $code);
116 116
 
117 117
             if (strlen($code) < 12) {
118
-                $this->message->reply('Invalid Code, check '.$this->config['bot']['trigger'].'help auth for more info.');
118
+                $this->message->reply('Invalid Code, check ' . $this->config['bot']['trigger'] . 'help auth for more info.');
119 119
 
120 120
                 return;
121 121
             }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
                     foreach ($xml->result->rowset->row as $character) {
145 145
                         if ($character->attributes()->name != $userName) {
146 146
                             $this->message->reply('**Failure:** Your discord name must match your character name.');
147
-                            $this->logger->addInfo('User was denied due to not having the correct name '.$character->attributes()->name);
147
+                            $this->logger->addInfo('User was denied due to not having the correct name ' . $character->attributes()->name);
148 148
 
149 149
                             return;
150 150
                         }
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
                                 $member->save();
163 163
                                 insertUser($this->db, $this->dbUser, $this->dbPass, $this->dbName, $userID, $charid, $eveName, 'corp');
164 164
                                 disableReg($this->db, $this->dbUser, $this->dbPass, $this->dbName, $code);
165
-                                $this->message->reply('**Success:** You have now been added to the '.$this->roleName.' group. To get more roles, talk to the CEO / Directors');
166
-                                $this->logger->addInfo('User authed and added to corp group '.$eveName);
165
+                                $this->message->reply('**Success:** You have now been added to the ' . $this->roleName . ' group. To get more roles, talk to the CEO / Directors');
166
+                                $this->logger->addInfo('User authed and added to corp group ' . $eveName);
167 167
 
168 168
                                 return;
169 169
                             }
@@ -179,21 +179,21 @@  discard block
 block discarded – undo
179 179
                                 $member->save();
180 180
                                 insertUser($this->db, $this->dbUser, $this->dbPass, $this->dbName, $userID, $charid, $eveName, 'ally');
181 181
                                 disableReg($this->db, $this->dbUser, $this->dbPass, $this->dbName, $code);
182
-                                $this->message->reply('**Success:** You have now been added to the '.$this->allyroleName.' group. To get more roles, talk to the CEO / Directors');
183
-                                $this->logger->addInfo('User authed and added to the alliance group '.$eveName);
182
+                                $this->message->reply('**Success:** You have now been added to the ' . $this->allyroleName . ' group. To get more roles, talk to the CEO / Directors');
183
+                                $this->logger->addInfo('User authed and added to the alliance group ' . $eveName);
184 184
 
185 185
                                 return;
186 186
                             }
187 187
                         }
188 188
                     }
189 189
                     $this->message->reply('**Failure:** There are no roles available for your corp/alliance.');
190
-                    $this->logger->addInfo('User was denied due to not being in the correct corp or alliance '.$eveName);
190
+                    $this->logger->addInfo('User was denied due to not being in the correct corp or alliance ' . $eveName);
191 191
 
192 192
                     return;
193 193
                 }
194 194
             }
195 195
             $this->message->reply('**Failure:** There was an issue with your code.');
196
-            $this->logger->addInfo('User was denied due to not being in the correct corp or alliance '.$userName);
196
+            $this->logger->addInfo('User was denied due to not being in the correct corp or alliance ' . $userName);
197 197
 
198 198
             return;
199 199
         }
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
     {
207 207
         return [
208 208
             'name'        => 'auth',
209
-            'trigger'     => [$this->config['bot']['trigger'].'auth'],
210
-            'information' => 'SSO based auth system. '.$this->ssoUrl.' Visit the link and login with your main EVE account, select the correct character, and put the !auth <string> you receive in chat.',
209
+            'trigger'     => [$this->config['bot']['trigger'] . 'auth'],
210
+            'information' => 'SSO based auth system. ' . $this->ssoUrl . ' Visit the link and login with your main EVE account, select the correct character, and put the !auth <string> you receive in chat.',
211 211
         ];
212 212
     }
213 213
 
Please login to merge, or discard this patch.