Passed
Branch master (120d90)
by
unknown
02:31
created
src/lib/logs.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -4,6 +4,7 @@
 block discarded – undo
4 4
  * @author Torleif Berger, Lorenzo Stanco
5 5
  * @link http://stackoverflow.com/a/15025877/995958
6 6
  * @license http://creativecommons.org/licenses/by/3.0/
7
+ * @param string $filepath
7 8
  */
8 9
 function tailCustom($filepath, $lines = 1, $adaptive = true)
9 10
 {
Please login to merge, or discard this patch.
Braces   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,16 +9,23 @@
 block discarded – undo
9 9
 {
10 10
     // Open file
11 11
     $f = @fopen($filepath, "rb");
12
-    if ($f === false) return false;
12
+    if ($f === false) {
13
+        return false;
14
+    }
13 15
     // Sets buffer size, according to the number of lines to retrieve.
14 16
     // This gives a performance boost when reading a few lines from the file.
15
-    if (!$adaptive) $buffer = 4096;
16
-    else $buffer = ($lines < 2 ? 64 : ($lines < 10 ? 512 : 4096));
17
+    if (!$adaptive) {
18
+        $buffer = 4096;
19
+    } else {
20
+        $buffer = ($lines < 2 ? 64 : ($lines < 10 ? 512 : 4096));
21
+    }
17 22
     // Jump to last character
18 23
     fseek($f, -1, SEEK_END);
19 24
     // Read it and adjust line number if necessary
20 25
     // (Otherwise the result would be wrong if file doesn't end with a blank line)
21
-    if (fread($f, 1) != "\n") $lines -= 1;
26
+    if (fread($f, 1) != "\n") {
27
+        $lines -= 1;
28
+    }
22 29
 
23 30
     // Start reading
24 31
     $output = '';
Please login to merge, or discard this patch.
src/plugins/admin/getLog.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
             $roles = $member->roles;
87 87
             foreach ($roles as $role) {
88 88
                 if (in_array($role->name, $adminRoles, true)) {
89
-                    $logType = (string)$data["messageString"];
89
+                    $logType = (string) $data["messageString"];
90 90
                     if ($logType == "log") {
91 91
                         $filePath = dirname(__FILE__) . "/../../../log/dramielLog.log";
92 92
                     } elseif ($logType == "error") {
Please login to merge, or discard this patch.
src/plugins/onTick/getKillmails.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         $this->groupConfig = $config["plugins"]["getKillmails"]["groupConfig"];
70 70
         $this->guild = $config["bot"]["guild"];
71 71
         //Refresh check at bot start
72
-        setPermCache("killmailCheck",  time() - 5);
72
+        setPermCache("killmailCheck", time() - 5);
73 73
     }
74 74
 
75 75
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
     function getKM()
116 116
     {
117
-        foreach($this->groupConfig as $kmGroup) {
117
+        foreach ($this->groupConfig as $kmGroup) {
118 118
             $killID = getPermCache("{$kmGroup["name"]}newestKillmailID");
119 119
             //check if start id is greater than current id and if it is set
120 120
             if ($kmGroup["startMail"] > $killID || is_null($killID)) {
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
                 foreach ($kills as $kill) {
145 145
                     if ($i < 10) {
146 146
                         //if big kill isn't set, disable it
147
-                        if (is_null($kmGroup["bigKill"])){
147
+                        if (is_null($kmGroup["bigKill"])) {
148 148
                             $kmGroup["bigKill"] = 99999999999999999999999999;
149 149
                         }
150 150
                         $killID = $kill['killID'];
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
                         $shipName = apiTypeName($victimShipID);
160 160
                         $rawValue = $kill['zkb']['totalValue'];
161 161
                         //Check if killmail meets minimum value
162
-                        if (isset($kmGroup["minimumValue"])){
163
-                            if ($rawValue < $kmGroup["minimumValue"]){
162
+                        if (isset($kmGroup["minimumValue"])) {
163
+                            if ($rawValue < $kmGroup["minimumValue"]) {
164 164
                                 $this->logger->addInfo("Killmails: Mail {$killID} ignored for not meeting the minimum value required.");
165 165
                                 setPermCache("{$kmGroup["name"]}newestKillmailID", $killID);
166 166
                                 continue;
Please login to merge, or discard this patch.
Dramiel.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 
128 128
 $discord->on(
129 129
     'ready',
130
-    function ($discord) use ($logger, $config, $plugins, $pluginsT, $discord) {
130
+    function($discord) use ($logger, $config, $plugins, $pluginsT, $discord) {
131 131
         // In here we can access any of the WebSocket events.
132 132
         //
133 133
         // There is a list of event constants that you can
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         $logger->addInfo('Discord WebSocket is ready!' . PHP_EOL);
138 138
 
139 139
         // Database check
140
-        $discord->loop->addPeriodicTimer(86400, function () use ($logger) {
140
+        $discord->loop->addPeriodicTimer(86400, function() use ($logger) {
141 141
             updateDramielDB($logger);
142 142
         });
143 143
 
@@ -152,21 +152,21 @@  discard block
 block discarded – undo
152 152
         $discord->updatePresence($game);
153 153
 
154 154
         // Server Status Check (tick plugins will not run if eve is offline)
155
-        $discord->loop->addPeriodicTimer(60, function () use ($logger) {
155
+        $discord->loop->addPeriodicTimer(60, function() use ($logger) {
156 156
             $crestData = json_decode(downloadData("https://crest-tq.eveonline.com/"), true);
157 157
             $crestStatus = isset($crestData["serviceStatus"]) ? $crestData["serviceStatus"] : "offline";
158 158
             setPermCache("serverState", $crestStatus);
159 159
         });
160 160
 
161 161
         // Run the Tick plugins
162
-        $discord->loop->addPeriodicTimer(3, function () use ($pluginsT) {
162
+        $discord->loop->addPeriodicTimer(3, function() use ($pluginsT) {
163 163
             foreach ($pluginsT as $plugin) {
164 164
                 $plugin->tick();
165 165
             }
166 166
         });
167 167
 
168 168
         // Message queue
169
-        $discord->loop->addPeriodicTimer(7, function () use ($discord, $logger) {
169
+        $discord->loop->addPeriodicTimer(7, function() use ($discord, $logger) {
170 170
             $id = getOldestMessage();
171 171
             $id = $id["MIN(id)"];
172 172
             if (is_null($id)) {
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
         });
184 184
 
185 185
         // Mem cleanup every 30 minutes
186
-        $discord->loop->addPeriodicTimer(1800, function () use ($logger) {
186
+        $discord->loop->addPeriodicTimer(1800, function() use ($logger) {
187 187
             $logger->addInfo("Memory in use: " . memory_get_usage() / 1024 / 1024 . "MB");
188 188
             gc_collect_cycles(); // Collect garbage
189 189
             $logger->addInfo("Memory in use after garbage collection: " . memory_get_usage() / 1024 / 1024 . "MB");
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 
192 192
         $discord->on(
193 193
             Event::MESSAGE_CREATE,
194
-            function ($message) use ($logger, $config, $plugins) {
194
+            function($message) use ($logger, $config, $plugins) {
195 195
 
196 196
                 $msgData = array(
197 197
                     "message" => array(
@@ -232,19 +232,19 @@  discard block
 block discarded – undo
232 232
 );
233 233
 $discord->on(
234 234
     'error',
235
-    function ($error) use ($logger) {
235
+    function($error) use ($logger) {
236 236
         $logger->addError($error);
237 237
         exit(1);
238 238
     }
239 239
 );
240 240
 $discord->on(
241 241
     'reconnecting',
242
-    function () use ($logger) {
242
+    function() use ($logger) {
243 243
         $logger->addInfo('Websocket is reconnecting..');
244 244
     });
245 245
 $discord->on(
246 246
     'reconnected',
247
-    function () use ($logger) {
247
+    function() use ($logger) {
248 248
         $logger->addInfo('Websocket was reconnected..');
249 249
     });
250 250
 // Now we will run the ReactPHP Event Loop!
Please login to merge, or discard this patch.