Passed
Branch master (b6f4c9)
by
unknown
03:07
created
src/lib/Db.php 2 patches
Doc Comments   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 /**
91 91
  * @param string $query
92 92
  * @param array $params
93
- * @param null $db
93
+ * @param string $db
94 94
  * @return null|void
95 95
  * @internal param string $db
96 96
  */
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
 //CORP INFO
239 239
 /**
240
- * @param $corpID
240
+ * @param integer $corpID
241 241
  * @param $corpTicker
242 242
  * @param string $corpName
243 243
  */
@@ -246,6 +246,9 @@  discard block
 block discarded – undo
246 246
     dbExecute('REPLACE INTO corpCache (`corpID`, `corpTicker`, `corpName`) VALUES (:corpID,:corpTicker,:corpName)', array(':corpID' => $corpID, ':corpTicker' => $corpTicker, ':corpName' => $corpName));
247 247
 }
248 248
 
249
+/**
250
+ * @param integer $corpID
251
+ */
249 252
 function getCorpInfo($corpID)
250 253
 {
251 254
     return dbQueryRow('SELECT * FROM corpCache WHERE `corpID` = :corpID', array(':corpID' => $corpID));
@@ -290,6 +293,9 @@  discard block
 block discarded – undo
290 293
     return $query['typeName'];
291 294
 }
292 295
 
296
+/**
297
+ * @return string
298
+ */
293 299
 function getSystemID($solarSystemName)
294 300
 {
295 301
     $query = dbQueryRow('SELECT * FROM mapSolarSystems WHERE lower(`solarSystemName`) = :solarSystemName', array(':solarSystemName' => $solarSystemName), 'eve');
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
     $logger->pushHandler(new StreamHandler(__DIR__ . '/../../log/libraryError.log', Logger::DEBUG));
38 38
     if ($db === null) {
39 39
         $db = __DIR__ . '/../../database/dramiel.sqlite';
40
-    } elseif ($db === 'eve'){
40
+    } elseif ($db === 'eve') {
41 41
         $db = __DIR__ . '/../../database/eveData.db';
42 42
     }
43 43
 
Please login to merge, or discard this patch.
src/plugins/onMessage/sysInfo.php 2 patches
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -4,93 +4,93 @@  discard block
 block discarded – undo
4 4
 
5 5
 class sysInfo
6 6
 {
7
-	public $config;
8
-	public $discord;
9
-	public $logger;
10
-	private $excludeChannel;
11
-	private $message;
12
-	private $triggers;
13
-
14
-	public function init($config, $discord, $logger)
15
-	{
16
-		$this->config = $config;
17
-		$this->discord = $discord;
18
-		$this->logger = $logger;
19
-		$this->excludeChannel = $this->config['bot']['restrictedChannels'];
20
-		$this->triggers[] = $this->config['bot']['trigger'] . 'sys';
21
-		$this->triggers[] = $this->config['bot']['trigger'] . 'Sys';
22
-		$this->triggers[] = $this->config['bot']['trigger'] . 'sysinfo';
23
-		$this->triggers[] = $this->config['bot']['trigger'] . 'system';
24
-		$this->triggers[] = $this->config['bot']['trigger'] . 'System';
25
-		$this->triggers[] = $this->config['bot']['trigger'] . 'Sysinfo';
26
-	}
27
-
28
-	public function onMessage($msgData, $message)
29
-	{
30
-		$channelID = (int) $msgData['message']['channelID'];
31
-
32
-		if(in_array($channelID, $this->excludeChannel, true))
33
-		{
34
-			return null;
35
-		}
36
-
37
-		$this->message = $message;
38
-
39
-		$message = $msgData['message']['message'];
40
-		$user = $msgData['message']['from'];
41
-
42
-		$data = command($message, $this->information()['trigger'], $this->config['bot']['trigger']);
43
-		if(isset($data['trigger']))
44
-		{
45
-			$messageString = strstr($data['messageString'], '@') ? str_replace('<@', '', str_replace('>', '', $data['messageString'])) : $data['messageString'];
46
-			if(is_numeric($messageString))
47
-			{
48
-				$messageString = dbQueryField('SELECT name FROM usersSeen WHERE id = :id', 'name', array(':id' => $messageString));
49
-			}
50
-			$cleanString = urlencode($messageString);
51
-			$sysID = urlencode(getSystemID($cleanString));
52
-
53
-			//Check if we get a system back, otherwise check for partials
54
-			if(empty($sysID))
55
-			{
56
-				$search = "http://tools.pandemic-legion.pl/api/search/{$cleanString}";
57
-				$search = json_decode(file_get_contents($search));
58
-				$tot = 0;
59
-				$res = array();
60
-				foreach ($search as $s){
61
-					if ($s->type == "system"){
62
-						$tot++;
63
-						$res[] = $s->name;
64
-					}
65
-				}
66
-				if ($tot == 0){
67
-					return $this->message->reply('**Error:** no data available');
68
-				}
69
-				if ($tot == 1){
70
-					$sysID = urlencode(getSystemID($res[0]));
71
-					if(empty($sysID)){
72
-						return $this->message->reply('**Error:** no data available');
73
-					}
74
-				}
75
-				if ($tot > 1){
76
-					$res = implode(", ",$res);
77
-					return $this->message->reply("**Error:** Did you mean one of these? {$res}");
78
-				}			
79
-			}
80
-
81
-			$systemDetails = systemDetails($sysID);
82
-			if (null === $systemDetails)
83
-			{
84
-				return $this->message->reply('**Error:** ESI is down. Try again later.');
85
-			}
86
-
87
-			$url = "https://zkillboard.com/api/stats/solarSystemID/{$sysID}/";
88
-			$json = json_decode(file_get_contents($url));
89
-
90
-			$regionID = $json->info->regionID;
91
-			$regionName = getRegionName($regionID);
92
-
93
-			$thisMonth = (string)date('Ym');
7
+    public $config;
8
+    public $discord;
9
+    public $logger;
10
+    private $excludeChannel;
11
+    private $message;
12
+    private $triggers;
13
+
14
+    public function init($config, $discord, $logger)
15
+    {
16
+        $this->config = $config;
17
+        $this->discord = $discord;
18
+        $this->logger = $logger;
19
+        $this->excludeChannel = $this->config['bot']['restrictedChannels'];
20
+        $this->triggers[] = $this->config['bot']['trigger'] . 'sys';
21
+        $this->triggers[] = $this->config['bot']['trigger'] . 'Sys';
22
+        $this->triggers[] = $this->config['bot']['trigger'] . 'sysinfo';
23
+        $this->triggers[] = $this->config['bot']['trigger'] . 'system';
24
+        $this->triggers[] = $this->config['bot']['trigger'] . 'System';
25
+        $this->triggers[] = $this->config['bot']['trigger'] . 'Sysinfo';
26
+    }
27
+
28
+    public function onMessage($msgData, $message)
29
+    {
30
+        $channelID = (int) $msgData['message']['channelID'];
31
+
32
+        if(in_array($channelID, $this->excludeChannel, true))
33
+        {
34
+            return null;
35
+        }
36
+
37
+        $this->message = $message;
38
+
39
+        $message = $msgData['message']['message'];
40
+        $user = $msgData['message']['from'];
41
+
42
+        $data = command($message, $this->information()['trigger'], $this->config['bot']['trigger']);
43
+        if(isset($data['trigger']))
44
+        {
45
+            $messageString = strstr($data['messageString'], '@') ? str_replace('<@', '', str_replace('>', '', $data['messageString'])) : $data['messageString'];
46
+            if(is_numeric($messageString))
47
+            {
48
+                $messageString = dbQueryField('SELECT name FROM usersSeen WHERE id = :id', 'name', array(':id' => $messageString));
49
+            }
50
+            $cleanString = urlencode($messageString);
51
+            $sysID = urlencode(getSystemID($cleanString));
52
+
53
+            //Check if we get a system back, otherwise check for partials
54
+            if(empty($sysID))
55
+            {
56
+                $search = "http://tools.pandemic-legion.pl/api/search/{$cleanString}";
57
+                $search = json_decode(file_get_contents($search));
58
+                $tot = 0;
59
+                $res = array();
60
+                foreach ($search as $s){
61
+                    if ($s->type == "system"){
62
+                        $tot++;
63
+                        $res[] = $s->name;
64
+                    }
65
+                }
66
+                if ($tot == 0){
67
+                    return $this->message->reply('**Error:** no data available');
68
+                }
69
+                if ($tot == 1){
70
+                    $sysID = urlencode(getSystemID($res[0]));
71
+                    if(empty($sysID)){
72
+                        return $this->message->reply('**Error:** no data available');
73
+                    }
74
+                }
75
+                if ($tot > 1){
76
+                    $res = implode(", ",$res);
77
+                    return $this->message->reply("**Error:** Did you mean one of these? {$res}");
78
+                }			
79
+            }
80
+
81
+            $systemDetails = systemDetails($sysID);
82
+            if (null === $systemDetails)
83
+            {
84
+                return $this->message->reply('**Error:** ESI is down. Try again later.');
85
+            }
86
+
87
+            $url = "https://zkillboard.com/api/stats/solarSystemID/{$sysID}/";
88
+            $json = json_decode(file_get_contents($url));
89
+
90
+            $regionID = $json->info->regionID;
91
+            $regionName = getRegionName($regionID);
92
+
93
+            $thisMonth = (string)date('Ym');
94 94
             $lastMonth = (string)date('Ym', strtotime('first day of previous month'));
95 95
 
96 96
             $thisMonthKill = $json->months->$thisMonth->shipsDestroyed;
@@ -100,21 +100,21 @@  discard block
 block discarded – undo
100 100
             $activeKills = $activePVP->kills->count;
101 101
             $activeChars = $activePVP->characters->count;
102 102
 
103
-			$sysName = $systemDetails['name'];
104
-			$secStatus = round($systemDetails['security_status'],2);
103
+            $sysName = $systemDetails['name'];
104
+            $secStatus = round($systemDetails['security_status'],2);
105 105
 
106
-			$npc = "https://api.eveonline.com/map/kills.xml.aspx";
107
-			$npc = new SimpleXMLElement(file_get_contents($npc));
108
-			foreach($npc->result->rowset->row as $row){
109
-				if($row->attributes()->solarSystemID == $sysID){
110
-					$npcKills = $row->attributes()->factionKills;
111
-					$podKills = $row->attributes()->podKills;
112
-				}
113
-			}
106
+            $npc = "https://api.eveonline.com/map/kills.xml.aspx";
107
+            $npc = new SimpleXMLElement(file_get_contents($npc));
108
+            foreach($npc->result->rowset->row as $row){
109
+                if($row->attributes()->solarSystemID == $sysID){
110
+                    $npcKills = $row->attributes()->factionKills;
111
+                    $podKills = $row->attributes()->podKills;
112
+                }
113
+            }
114 114
 
115
-			$url = "https://zkillboard.com/system/{$sysID}/";
115
+            $url = "https://zkillboard.com/system/{$sysID}/";
116 116
 
117
-			$msg = "```Systeminfo
117
+            $msg = "```Systeminfo
118 118
 Name: {$sysName} 
119 119
 Region: {$regionName}
120 120
 Security: {$secStatus}
@@ -131,18 +131,18 @@  discard block
 block discarded – undo
131 131
 ```
132 132
 
133 133
 More information: $url";
134
-			$this->logger->addInfo("sysInfo: Sending system information to {$user}");
135
-			$this->message->reply($msg);
136
-		}
137
-		return null;
138
-	}
139
-
140
-	public function information()
141
-	{
142
-		return array(
143
-			'name' => 'sys',
144
-			'trigger' => $this->triggers,
145
-			'information' => 'Returns information for the given system'
146
-			);
147
-	}
134
+            $this->logger->addInfo("sysInfo: Sending system information to {$user}");
135
+            $this->message->reply($msg);
136
+        }
137
+        return null;
138
+    }
139
+
140
+    public function information()
141
+    {
142
+        return array(
143
+            'name' => 'sys',
144
+            'trigger' => $this->triggers,
145
+            'information' => 'Returns information for the given system'
146
+            );
147
+    }
148 148
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	{
30 30
 		$channelID = (int) $msgData['message']['channelID'];
31 31
 
32
-		if(in_array($channelID, $this->excludeChannel, true))
32
+		if (in_array($channelID, $this->excludeChannel, true))
33 33
 		{
34 34
 			return null;
35 35
 		}
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 		$user = $msgData['message']['from'];
41 41
 
42 42
 		$data = command($message, $this->information()['trigger'], $this->config['bot']['trigger']);
43
-		if(isset($data['trigger']))
43
+		if (isset($data['trigger']))
44 44
 		{
45 45
 			$messageString = strstr($data['messageString'], '@') ? str_replace('<@', '', str_replace('>', '', $data['messageString'])) : $data['messageString'];
46
-			if(is_numeric($messageString))
46
+			if (is_numeric($messageString))
47 47
 			{
48 48
 				$messageString = dbQueryField('SELECT name FROM usersSeen WHERE id = :id', 'name', array(':id' => $messageString));
49 49
 			}
@@ -51,29 +51,29 @@  discard block
 block discarded – undo
51 51
 			$sysID = urlencode(getSystemID($cleanString));
52 52
 
53 53
 			//Check if we get a system back, otherwise check for partials
54
-			if(empty($sysID))
54
+			if (empty($sysID))
55 55
 			{
56 56
 				$search = "http://tools.pandemic-legion.pl/api/search/{$cleanString}";
57 57
 				$search = json_decode(file_get_contents($search));
58 58
 				$tot = 0;
59 59
 				$res = array();
60
-				foreach ($search as $s){
61
-					if ($s->type == "system"){
60
+				foreach ($search as $s) {
61
+					if ($s->type == "system") {
62 62
 						$tot++;
63 63
 						$res[] = $s->name;
64 64
 					}
65 65
 				}
66
-				if ($tot == 0){
66
+				if ($tot == 0) {
67 67
 					return $this->message->reply('**Error:** no data available');
68 68
 				}
69
-				if ($tot == 1){
69
+				if ($tot == 1) {
70 70
 					$sysID = urlencode(getSystemID($res[0]));
71
-					if(empty($sysID)){
71
+					if (empty($sysID)) {
72 72
 						return $this->message->reply('**Error:** no data available');
73 73
 					}
74 74
 				}
75
-				if ($tot > 1){
76
-					$res = implode(", ",$res);
75
+				if ($tot > 1) {
76
+					$res = implode(", ", $res);
77 77
 					return $this->message->reply("**Error:** Did you mean one of these? {$res}");
78 78
 				}			
79 79
 			}
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 			$regionID = $json->info->regionID;
91 91
 			$regionName = getRegionName($regionID);
92 92
 
93
-			$thisMonth = (string)date('Ym');
94
-            $lastMonth = (string)date('Ym', strtotime('first day of previous month'));
93
+			$thisMonth = (string) date('Ym');
94
+            $lastMonth = (string) date('Ym', strtotime('first day of previous month'));
95 95
 
96 96
             $thisMonthKill = $json->months->$thisMonth->shipsDestroyed;
97 97
             $lastMonthKill = $json->months->$lastMonth->shipsDestroyed;
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
             $activeChars = $activePVP->characters->count;
102 102
 
103 103
 			$sysName = $systemDetails['name'];
104
-			$secStatus = round($systemDetails['security_status'],2);
104
+			$secStatus = round($systemDetails['security_status'], 2);
105 105
 
106 106
 			$npc = "https://api.eveonline.com/map/kills.xml.aspx";
107 107
 			$npc = new SimpleXMLElement(file_get_contents($npc));
108
-			foreach($npc->result->rowset->row as $row){
109
-				if($row->attributes()->solarSystemID == $sysID){
108
+			foreach ($npc->result->rowset->row as $row) {
109
+				if ($row->attributes()->solarSystemID == $sysID) {
110 110
 					$npcKills = $row->attributes()->factionKills;
111 111
 					$podKills = $row->attributes()->podKills;
112 112
 				}
Please login to merge, or discard this patch.