This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /* zKillboard |
||
3 | * Copyright (C) 2012-2015 EVE-KILL Team and EVSCO. |
||
4 | * |
||
5 | * This program is free software: you can redistribute it and/or modify |
||
6 | * it under the terms of the GNU Affero General Public License as published by |
||
7 | * the Free Software Foundation, either version 3 of the License, or |
||
8 | * (at your option) any later version. |
||
9 | * |
||
10 | * This program is distributed in the hope that it will be useful, |
||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
13 | * GNU Affero General Public License for more details. |
||
14 | * |
||
15 | * You should have received a copy of the GNU Affero General Public License |
||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
17 | */ |
||
18 | |||
19 | class Info |
||
20 | { |
||
21 | /** |
||
22 | * Retrieve the system id of a solar system. |
||
23 | * |
||
24 | * @static |
||
25 | * @param string $systemName |
||
26 | * @return int The solarSystemID |
||
27 | */ |
||
28 | public static function getSystemID($systemName) |
||
29 | { |
||
30 | return Db::queryField("select solarSystemID from ccp_systems where solarSystemName = :name", "solarSystemID", |
||
31 | array(":name" => $systemName), 3600); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @static |
||
36 | * @param int $systemID |
||
37 | * @return array Returns an array containing the solarSystemName and security of a solarSystemID |
||
38 | */ |
||
39 | public static function getSystemInfo($systemID) |
||
40 | { |
||
41 | return Db::queryRow("select solarSystemName, security, sunTypeID from ccp_systems where solarSystemID = :systemID", |
||
42 | array(":systemID" => $systemID), 3600); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * Fetches information for a wormhole system |
||
47 | * @param int $systemID |
||
48 | * @return array |
||
49 | */ |
||
50 | public static function getWormholeSystemInfo($systemID) |
||
51 | { |
||
52 | if ($systemID < 3100000) return; |
||
53 | return Db::queryRow("select * from ccp_zwormhole_info where solarSystemID = :systemID", |
||
54 | array(":systemID" => $systemID), 3600); |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * @static |
||
59 | * @param int $systemID |
||
60 | * @return string The system name of a solarSystemID |
||
61 | */ |
||
62 | public static function getSystemName($systemID) |
||
63 | { |
||
64 | $systemInfo = self::getSystemInfo($systemID); |
||
65 | return $systemInfo['solarSystemName']; |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * @static |
||
70 | * @param int $systemID |
||
71 | * @return double The system secruity of a solarSystemID |
||
72 | */ |
||
73 | public static function getSystemSecurity($systemID) |
||
74 | { |
||
75 | $systemInfo = self::getSystemInfo($systemID); |
||
76 | return $systemInfo['security']; |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * @static |
||
81 | * @param int $typeID |
||
82 | * @return string The item name. |
||
83 | */ |
||
84 | public static function getItemName($typeID) |
||
85 | { |
||
86 | $name = Db::queryField("select typeName from ccp_invTypes where typeID = :typeID", "typeName", |
||
87 | array(":typeID" => $typeID), 3600); |
||
88 | if ($name === null) { |
||
89 | if ($typeID >= 500000) return "TypeID $typeID"; //throw new Exception("hey now"); |
||
90 | Db::execute("insert ignore into ccp_invTypes (typeID, typeName) values (:typeID, :typeName)", |
||
91 | array(":typeID" => $typeID, ":typeName" => "TypeID $typeID")); |
||
92 | $name = "TypeID $typeID"; |
||
93 | } |
||
94 | return $name; |
||
95 | } |
||
96 | |||
97 | /** |
||
98 | * @param string $itemName |
||
99 | * @return int The typeID of an item. |
||
100 | */ |
||
101 | public static function getItemID($itemName) |
||
102 | { |
||
103 | return Db::queryField("select typeID from ccp_invTypes where typeName = :typeName", "typeID", |
||
104 | array(":typeName" => $itemName), 3600); |
||
105 | } |
||
106 | |||
107 | /** |
||
108 | * Retrieves the effectID of an item. This is useful for determining if an item is fitted into a low, |
||
109 | * medium, high, rig, or t3 slot. |
||
110 | * |
||
111 | * @param int $typeID |
||
112 | * @return int The effectID of an item. |
||
113 | */ |
||
114 | public static function getEffectID($typeID) |
||
115 | { |
||
116 | return Db::queryField("select effectID from ccp_dgmTypeEffects where typeID = :typeID and effectID in (11, 12, 13, 2663, 3772)", "effectID", |
||
117 | array(":typeID" => $typeID), 3600); |
||
118 | } |
||
119 | |||
120 | /** |
||
121 | * Retrieves the name of a corporation ID |
||
122 | * |
||
123 | * @param string $name |
||
124 | * @return int The corporationID of a corporation |
||
125 | */ |
||
126 | public static function getCorpID($name) |
||
127 | { |
||
128 | $id = Db::queryField("select corporationID from zz_corporations where name = :name order by memberCount desc limit 1", "corporationID", |
||
129 | array(":name" => $name), 3600); |
||
130 | |||
131 | if ($id == null || $id == 0) { |
||
132 | try { |
||
133 | $pheal = Util::getPheal(); |
||
134 | $pheal->scope = "eve"; |
||
135 | $charInfo = $pheal->CharacterID(array("names" => $name)); |
||
136 | foreach ($charInfo->characters as $char) { |
||
137 | $id = (int)$char->characterID; |
||
138 | if ($id != 0) { |
||
139 | // Verify that this is indeed a character |
||
140 | $pheal->scope = "corp"; |
||
141 | $name = $charInfo->corporationName; |
||
142 | // If not a corporation an error would have been thrown and caught by the catch |
||
143 | Db::execute("insert ignore into zz_corporations (corporationID, name) values (:id, :name)", |
||
144 | array(":id" => $id, ":name" => $name)); |
||
145 | } |
||
146 | } |
||
147 | } |
||
148 | catch (Exception $ex) { |
||
149 | $id = 0; |
||
150 | } |
||
151 | } |
||
152 | return $id; |
||
153 | } |
||
154 | |||
155 | /** |
||
156 | * @param int $allianceID |
||
157 | * @return array |
||
158 | */ |
||
159 | public static function getCorps($allianceID) |
||
160 | { |
||
161 | $corpList = Db::query("select * from zz_corporations where allianceID = :alliID order by name", |
||
162 | array(":alliID" => $allianceID)); |
||
163 | |||
164 | $retList = array(); |
||
165 | foreach ($corpList as $corp) { |
||
166 | $count = Db::queryField("select count(1) count from zz_api_characters where isDirector = 'T' and corporationID = :corpID", "count", array(":corpID" => $corp["corporationID"])); |
||
167 | $corp["apiVerified"] = $count > 0 ? 1 : 0; |
||
168 | |||
169 | if ($count) { |
||
170 | $errors = Db::query("select errorCode from zz_api_characters where isDirector = 'T' and corporationID = :corpID", |
||
171 | array(":corpID" => $corp["corporationID"])); |
||
172 | $corp["keyCount"] = sizeof($errors); |
||
173 | $errorValues = array(); |
||
174 | foreach ($errors as $error) $errorValues[] = $error["errorCode"]; |
||
175 | $corp["errors"] = implode(", ", $errorValues); |
||
176 | $corp["cachedUntil"] = Db::queryField("select min(cachedUntil) cachedUntil from zz_api_characters where isDirector = 'T' and corporationID = :corpID", "cachedUntil", |
||
177 | array(":corpID" => $corp["corporationID"])); |
||
178 | $corp["lastChecked"] = Db::queryField("select max(lastChecked) lastChecked from zz_api_characters where isDirector = 'T' and corporationID = :corpID", "lastChecked", |
||
179 | array(":corpID" => $corp["corporationID"])); |
||
180 | } |
||
181 | else { |
||
182 | $count = Db::queryField("select count(*) count from zz_api_characters where corporationID = :corpID", "count", |
||
183 | array(":corpID" => $corp["corporationID"])); |
||
184 | $percentage = $corp["memberCount"] == 0 ? 0 : $count / $corp["memberCount"]; |
||
185 | if ($percentage == 1) $corp["apiVerified"] = 1; |
||
186 | else if ($percentage > 0) $corp["apiPercentage"] = number_format($percentage * 100, 1); |
||
187 | } |
||
188 | self::addInfo($corp); |
||
189 | $retList[] = $corp; |
||
190 | } |
||
191 | return $retList; |
||
192 | } |
||
193 | |||
194 | /** |
||
195 | * Gets corporation stats |
||
196 | * @param int $allianceID |
||
197 | * @param array $parameters |
||
198 | * @return array |
||
199 | */ |
||
200 | public static function getCorpStats($allianceID, $parameters) |
||
201 | { |
||
202 | $corpList = Db::query("SELECT * FROM zz_corporations WHERE allianceID = :alliID ORDER BY name", array(":alliID" => $allianceID)); |
||
203 | $statList = array(); |
||
204 | foreach($corpList as $corp) |
||
205 | { |
||
206 | $parameters["corporationID"] = $corp["corporationID"]; |
||
207 | $data = self::getCorpDetails($corp["corporationID"], $parameters); |
||
208 | $statList[$corp["name"]]["corporationName"] = $data["corporationName"]; |
||
209 | $statList[$corp["name"]]["corporationID"] = $data["corporationID"]; |
||
210 | $statList[$corp["name"]]["ticker"] = $data["cticker"]; |
||
211 | $statList[$corp["name"]]["members"] = $data["memberCount"]; |
||
212 | $statList[$corp["name"]]["ceoName"] = $data["ceoName"]; |
||
213 | $statList[$corp["name"]]["ceoID"] = $data["ceoID"]; |
||
214 | $statList[$corp["name"]]["kills"] = $data["shipsDestroyed"]; |
||
215 | $statList[$corp["name"]]["killsIsk"] = $data["iskDestroyed"]; |
||
216 | $statList[$corp["name"]]["killPoints"] = $data["pointsDestroyed"]; |
||
217 | $statList[$corp["name"]]["losses"] = $data["shipsLost"]; |
||
218 | $statList[$corp["name"]]["lossesIsk"] = $data["iskLost"]; |
||
219 | $statList[$corp["name"]]["lossesPoints"] = $data["pointsLost"]; |
||
220 | if($data["iskDestroyed"] != 0 || $data["iskLost"] != 0) |
||
221 | $statList[$corp["name"]]["effeciency"] = $data["iskDestroyed"] / ($data["iskDestroyed"] + $data["iskLost"]) * 100; |
||
222 | else $statList[$corp["name"]]["effeciency"] = 0; |
||
223 | } |
||
224 | return $statList; |
||
225 | } |
||
226 | |||
227 | /** |
||
228 | * Adds an alliance |
||
229 | * @param int $id |
||
230 | * @param string $name |
||
231 | */ |
||
232 | public static function addAlli($id, $name) |
||
233 | { |
||
234 | if ($id <= 0) return; |
||
235 | $exists = Db::queryField("select count(1) count from zz_alliances where allianceID = :id", "count", array(":id" => $id)); |
||
236 | if ($exists == 0) Db::execute("insert ignore into zz_alliances (allianceID, name) values (:id, :name)", array(":id" => $id, ":name" => $name)); |
||
237 | } |
||
238 | |||
239 | /** |
||
240 | * Gets an alliance name |
||
241 | * @param int $id |
||
242 | * @return string |
||
243 | */ |
||
244 | public static function getAlliName($id) |
||
245 | { |
||
246 | return Db::queryField("select name from zz_alliances where allianceID = :id order by memberCount desc limit 1", "name", |
||
247 | array(":id" => $id), 3600); |
||
248 | } |
||
249 | |||
250 | /** |
||
251 | * [getFactionTicker description] |
||
252 | * @param string $ticker |
||
253 | * @return string|null |
||
254 | */ |
||
255 | public static function getFactionTicker($ticker) |
||
256 | { |
||
257 | $data = array( |
||
258 | "caldari" => array("factionID" => "500001", "name" => "Caldari State"), |
||
259 | "minmatar" => array("factionID" => "500002", "name" => "Minmatar Republic"), |
||
260 | "amarr" => array("factionID" => "500003", "name" => "Amarr Empire"), |
||
261 | "gallente" => array("factionID" => "500004", "name" => "Gallente Federation") |
||
262 | ); |
||
263 | |||
264 | if (isset($data[$ticker])) return $data[$ticker]; |
||
265 | return null; |
||
266 | } |
||
267 | |||
268 | /** |
||
269 | * [getFactionID description] |
||
270 | * @param string $name |
||
271 | * @return string|bool |
||
272 | */ |
||
273 | public static function getFactionID($name) |
||
274 | { |
||
275 | $data = Db::queryRow("select * from ccp_zfactions where name = :name", array(":name" => $name)); |
||
276 | return isset($data["factionID"]) ? $data["factionID"] : null; |
||
277 | } |
||
278 | |||
279 | /** |
||
280 | * [getFactionName description] |
||
281 | * @param int $id |
||
282 | * @return string|false |
||
283 | */ |
||
284 | public static function getFactionName($id) |
||
285 | { |
||
286 | $data = Db::queryRow("select * from ccp_zfactions where factionID = :id", array(":id" => $id)); |
||
287 | return isset($data["name"]) ? $data["name"] : "Faction $id"; |
||
288 | } |
||
289 | |||
290 | /** |
||
291 | * [getRegionName description] |
||
292 | * @param int $id |
||
293 | * @return string |
||
294 | */ |
||
295 | public static function getRegionName($id) |
||
296 | { |
||
297 | $data = Db::queryField("select regionName from ccp_regions where regionID = :id", "regionName", |
||
298 | array(":id" => $id), 3600); |
||
299 | return $data; |
||
300 | } |
||
301 | |||
302 | /** |
||
303 | * [getRegionID description] |
||
304 | * @param string $name |
||
305 | * @return string |
||
306 | */ |
||
307 | public static function getRegionID($name) |
||
308 | { |
||
309 | return Db::queryField("select regionID from ccp_regions where regionName = :name", "regionID", |
||
310 | array(":name" => $name), 3600); |
||
311 | } |
||
312 | |||
313 | /** |
||
314 | * [getRegionIDFromSystemID description] |
||
315 | * @param int $systemID |
||
316 | * @return int |
||
317 | */ |
||
318 | public static function getRegionIDFromSystemID($systemID) |
||
319 | { |
||
320 | $regionID = Db::queryField("select regionID from ccp_systems where solarSystemID = :systemID", "regionID", |
||
321 | array(":systemID" => $systemID), 3600); |
||
322 | return $regionID; |
||
323 | } |
||
324 | |||
325 | /** |
||
326 | * [getRegionInfoFromSystemID description] |
||
327 | * @param int $systemID |
||
328 | * @return array |
||
329 | */ |
||
330 | public static function getRegionInfoFromSystemID($systemID) |
||
331 | { |
||
332 | $regionID = Db::queryField("select regionID from ccp_systems where solarSystemID = :systemID", "regionID", |
||
333 | array(":systemID" => $systemID), 3600); |
||
334 | return Db::queryRow("select * from ccp_regions where regionID = :regionID", array(":regionID" => $regionID), 3600); |
||
335 | } |
||
336 | |||
337 | /** |
||
338 | * [getShipId description] |
||
339 | * @param string $name |
||
340 | * @return int |
||
341 | */ |
||
342 | public static function getShipId($name) |
||
343 | { |
||
344 | $shipID = Db::queryField("select typeID from ccp_invTypes where typeName = :name", "typeID", |
||
345 | array(":name" => $name), 3600); |
||
346 | return $shipID; |
||
347 | } |
||
348 | |||
349 | public static function getShipName($id) |
||
350 | { |
||
351 | $shipName = Db::queryField("SELECT typeName FROM ccp_invTypes WHERE typeID = :id", "typeName", array(":id" => $id), 3600); |
||
352 | return $shipName; |
||
353 | } |
||
354 | |||
355 | /** |
||
356 | * Attempt to find the name of a corporation in the corporations table. If not found then attempt to pull the name via an API lookup. |
||
357 | * |
||
358 | * @static |
||
359 | * @param int $id |
||
360 | * @return string The name of the corp if found, null otherwise. |
||
361 | */ |
||
362 | public static function getCorpName($id) |
||
363 | { |
||
364 | $name = Db::queryField("select name from zz_corporations where corporationID = :id", "name", |
||
365 | array(":id" => $id), 3600); |
||
366 | if ($name != null) return $name; |
||
367 | return "Corporation $id"; |
||
368 | } |
||
369 | |||
370 | public static function getCorporationTicker($corporationID) |
||
371 | { |
||
372 | $pheal = Util::getPheal(); |
||
373 | $pheal->scope = "corp"; |
||
374 | |||
375 | $data = $pheal->CorporationSheet(array("corporationID" => $corporationID)); |
||
376 | return $data->ticker; |
||
377 | } |
||
378 | |||
379 | /** |
||
380 | * [getAlliID description] |
||
381 | * @param string $name |
||
382 | * @return string |
||
383 | */ |
||
384 | public static function getAlliID($name) |
||
385 | { |
||
386 | return Db::queryField("select allianceID from zz_alliances where name = :name order by memberCount desc limit 1", "allianceID", |
||
387 | array(":name" => $name), 3600); |
||
388 | } |
||
389 | |||
390 | public static function getAllianceTicker($allianceID) |
||
391 | { |
||
392 | return Db::queryField("SELECT ticker FROM zz_alliances WHERE allianceID = :allianceID", "ticker", array(":allianceID" => $allianceID)); |
||
393 | } |
||
394 | |||
395 | /** |
||
396 | * [getCharID description] |
||
397 | * @param string $name |
||
398 | * @return int |
||
399 | */ |
||
400 | public static function getCharID($name) |
||
401 | { |
||
402 | if (Bin::get("s:$name", null) != null) return Bin::get("s:$name", null); |
||
403 | $id = (int)Db::queryField("select characterID from zz_characters where name = :name order by corporationID desc", "characterID", |
||
404 | array(":name" => $name), 3600); |
||
405 | if ($id == 0 || $id == NULL) { |
||
406 | try { |
||
407 | $pheal = Util::getPheal(); |
||
408 | $pheal->scope = "eve"; |
||
409 | $charInfo = $pheal->CharacterID(array("names" => $name)); |
||
410 | foreach ($charInfo->characters as $char) { |
||
411 | $id = $char->characterID; |
||
412 | if ($id != 0) { |
||
413 | // Verify that this is indeed a character |
||
414 | $charInfo = $pheal->CharacterInfo(array("characterid" => $id)); |
||
415 | // If not a character an error would have been thrown and caught by the catch |
||
416 | $name = $charInfo->characterName; |
||
417 | Db::execute("insert ignore into zz_characters (characterID, name) values (:id, :name)", |
||
418 | array(":id" => $id, ":name" => $name)); |
||
419 | } |
||
420 | } |
||
421 | } |
||
422 | catch (Exception $ex) { |
||
423 | $id = 0; |
||
424 | } |
||
425 | } |
||
426 | Bin::set("s:$name", $id); |
||
427 | return $id; |
||
428 | } |
||
429 | |||
430 | /** |
||
431 | * [addChar description] |
||
432 | * @param int $id |
||
433 | * @param string $name |
||
434 | */ |
||
435 | public static function addChar($id, $name) |
||
436 | { |
||
437 | if ($id <= 0) return; |
||
438 | $exists = Db::queryField("select count(1) count from zz_characters where characterID = :id", "count", array(":id" => $id)); |
||
439 | if ($exists == 0) Db::execute("insert ignore into zz_characters (characterID, name) values (:id, :name)", array(":id" => $id, ":name" => $name)); |
||
440 | StatsD::increment("characters_Added"); |
||
441 | } |
||
442 | |||
443 | /** |
||
444 | * Attempt to find the name of a character in the characters table. If not found then attempt to pull the name via an API lookup. |
||
445 | * |
||
446 | * @static |
||
447 | * @param int $id |
||
448 | * @return string The name of the corp if found, null otherwise. |
||
449 | */ |
||
450 | public static function getCharName($id) |
||
451 | { |
||
452 | $name = Db::queryField("select name from zz_characters where characterID = :id", "name", array(":id" => $id), 3600); |
||
453 | if ($name != null) return $name; |
||
454 | if ($id < 39999999) return ""; // Don't try to look up invalid characterID's |
||
455 | |||
456 | try { |
||
457 | $pheal = Util::getPheal(); |
||
458 | $pheal->scope = "eve"; |
||
459 | $charInfo = $pheal->CharacterInfo(array("characterid" => $id)); |
||
460 | $name = $charInfo->characterName; |
||
461 | if ($name != null) { //addName($id, $name, 1, 1, null); |
||
462 | Db::execute("insert ignore into zz_characters (characterID, name) values (:id, :name)", |
||
463 | array(":id" => $id, ":name" => $name)); |
||
464 | } |
||
465 | } catch (Exception $ex) { |
||
466 | return $id; |
||
467 | } |
||
468 | return $name; |
||
469 | } |
||
470 | |||
471 | /** |
||
472 | * Character affiliation |
||
473 | */ |
||
474 | public static function getCharacterAffiliations($characterID) |
||
475 | { |
||
476 | $pheal = Util::getPheal(); |
||
477 | if($pheal == NULL) // 904ed most likely |
||
478 | return array("corporationID" => NULL, "corporationName" => NULL, "corporationTicker" => NULL, "allianceID" => NULL, "allianceName" => NULL, "allianceTicker" => NULL); |
||
479 | |||
480 | $pheal->scope = "eve"; |
||
481 | |||
482 | $affiliations = $pheal->CharacterAffiliation(array("ids" => $characterID)); |
||
483 | $corporationID = $affiliations->characters[0]->corporationID; |
||
484 | $corporationName = $affiliations->characters[0]->corporationName; |
||
485 | $allianceID = $affiliations->characters[0]->allianceID; |
||
486 | $allianceName = $affiliations->characters[0]->allianceName; |
||
487 | |||
488 | // Get the ticker for corp and alliance |
||
489 | $corporationTicker = Info::getCorporationTicker($corporationID); |
||
0 ignored issues
–
show
|
|||
490 | $allianceTicker = Info::getAllianceTicker($allianceID); |
||
0 ignored issues
–
show
As per coding style,
self should be used for accessing local static members.
This check looks for accesses to local static members using the fully qualified name instead
of <?php
class Certificate {
const TRIPLEDES_CBC = 'ASDFGHJKL';
private $key;
public function __construct()
{
$this->key = Certificate::TRIPLEDES_CBC;
}
}
While this is perfectly valid, the fully qualified name of ![]() |
|||
491 | |||
492 | return array("corporationID" => $corporationID, "corporationName" => $corporationName, "corporationTicker" => $corporationTicker, "allianceID" => $allianceID, "allianceName" => $allianceName, "allianceTicker" => $allianceTicker); |
||
493 | |||
494 | } |
||
495 | |||
496 | /** |
||
497 | * [getGroupID description] |
||
498 | * @param int $id |
||
499 | * @return int |
||
500 | */ |
||
501 | public static function getGroupID($id) |
||
502 | { |
||
503 | $groupID = Db::queryField("select groupID from ccp_invTypes where typeID = :id", "groupID", |
||
504 | array(":id" => $id), 3600); |
||
505 | if ($groupID === null) return 0; |
||
506 | return $groupID; |
||
507 | } |
||
508 | |||
509 | /** |
||
510 | * [getGroupIdFromName description] |
||
511 | * @param int $id |
||
512 | * @return int |
||
513 | */ |
||
514 | public static function getGroupIdFromName($id) |
||
515 | { |
||
516 | $groupID = Db::queryField("select groupID from ccp_invGroups where groupName = :id", "groupID", |
||
517 | array(":id" => $id), 3600); |
||
518 | if ($groupID === null) return 0; |
||
519 | return $groupID; |
||
520 | } |
||
521 | |||
522 | /** |
||
523 | * Get the name of the group |
||
524 | * |
||
525 | * @static |
||
526 | * @param int $groupID |
||
527 | * @return string |
||
528 | */ |
||
529 | public static function getGroupName($groupID) |
||
530 | { |
||
531 | $name = Db::queryField("select groupName from ccp_invGroups where groupID = :id", "groupName", |
||
532 | array(":id" => $groupID), 3600); |
||
533 | return $name; |
||
534 | } |
||
535 | |||
536 | /** |
||
537 | * @param string $search |
||
538 | */ |
||
539 | private static function findEntitySearch(&$resultArray, $type, $query, $search) |
||
540 | { |
||
541 | $results = Db::query("${query}", array(":search" => $search), 3600); |
||
542 | self::addResults($resultArray, $type, $results); |
||
543 | } |
||
544 | |||
545 | /** |
||
546 | * [addResults description] |
||
547 | * @param array $resultArray |
||
548 | * @param string $type |
||
549 | * @param array|null $results |
||
550 | */ |
||
551 | private static function addResults(&$resultArray, $type, $results) |
||
552 | { |
||
553 | if ($results != null) foreach ($results as $result) { |
||
554 | $keys = array_keys($result); |
||
555 | $result["type"] = $type; |
||
556 | $value = $result[$keys[0]]; |
||
557 | $resultArray["$type|$value"] = $result; |
||
558 | } |
||
559 | } |
||
560 | |||
561 | /** |
||
562 | * [$entities description] |
||
563 | * @var array |
||
564 | */ |
||
565 | private static $entities = array( |
||
566 | array("faction", "SELECT factionID, factionID id FROM ccp_zfactions WHERE name "), |
||
567 | array("faction", "SELECT factionID, factionID id FROM ccp_zfactions WHERE ticker "), |
||
568 | array("alliance", "SELECT allianceID, allianceID id FROM zz_alliances WHERE name "), |
||
569 | array("alliance", "SELECT allianceID, allianceID id FROM zz_alliances WHERE ticker ", true), |
||
570 | array("corporation", "SELECT corporationID, corporationID id FROM zz_corporations WHERE name "), |
||
571 | array("corporation", "SELECT corporationID, corporationID id FROM zz_corporations WHERE ticker ", true), |
||
572 | array("character", "SELECT characterID, characterID id FROM zz_characters WHERE name "), |
||
573 | array("item", "select typeID, typeID id from ccp_invTypes where published = 1 and typeName ", true), |
||
574 | array("system", "select solarSystemID, solarSystemID id from ccp_systems where solarSystemName "), |
||
575 | array("region", "select regionID, regionID id from ccp_regions where regionName "), |
||
576 | ); |
||
577 | |||
578 | /** |
||
579 | * Search for an entity |
||
580 | * |
||
581 | * @static |
||
582 | * @param string $search |
||
583 | * @return string |
||
584 | */ |
||
585 | public static function findEntity($search, $exact = false) |
||
586 | { |
||
587 | $search = trim($search); |
||
588 | if (!isset($search)) return ""; |
||
589 | |||
590 | $names = array(); |
||
591 | for ($i = 0; $i <= 1; $i++) { |
||
592 | if ($i == 1 && $exact) continue; |
||
593 | $match = $i == 0 ? " = " : " like "; |
||
594 | foreach (self::$entities as $entity) { |
||
595 | $type = $entity[0]; |
||
596 | $query = $entity[1]; |
||
597 | if (isset($entity[2]) && $entity[2] == true) continue; |
||
598 | self::findEntitySearch($names, $type, "$query $match :search limit 9", $search . ($i == 0 ? "" : "%")); |
||
599 | } |
||
600 | } |
||
601 | $retValue = array(); |
||
602 | foreach ($names as $id => $value) $retValue[] = $value; |
||
603 | self::addInfo($retValue); |
||
604 | return $retValue; |
||
605 | } |
||
606 | |||
607 | /** |
||
608 | * [findNames description] |
||
609 | * @param string $search |
||
610 | * @return array |
||
611 | */ |
||
612 | public static function findNames($search) |
||
613 | { |
||
614 | $array = self::findEntity($search); |
||
615 | $retValue = array(); |
||
616 | foreach ($array as $row) { |
||
617 | if (isset($row["characterName"])) $retValue[] = $row["characterName"]; |
||
618 | else if (isset($row["corporationName"])) $retValue[] = $row["corporationName"]; |
||
619 | else if (isset($row["allianceName"])) $retValue[] = $row["allianceName"]; |
||
620 | else if (isset($row["factionName"])) $retValue[] = $row["factionName"]; |
||
621 | else if (isset($row["typeName"])) $retValue[] = $row["typeName"]; |
||
622 | else if (isset($row["solarSystemName"])) $retValue[] = $row["solarSystemName"]; |
||
623 | else if (isset($row["regionName"])) $retValue[] = $row["regionName"]; |
||
624 | else if (isset($row["factionName"])) $retValue[] = $row["factionName"]; |
||
625 | } |
||
626 | return $retValue; |
||
627 | } |
||
628 | |||
629 | /** |
||
630 | * Gets a pilots details |
||
631 | * @param int $id |
||
632 | * @return array |
||
633 | */ |
||
634 | public static function getPilotDetails($id, $parameters = array()) |
||
635 | { |
||
636 | $data = Db::queryRow("select characterID, corporationID, allianceID, factionID from zz_participants where characterID = :id and dttm >= date_sub(now(), interval 7 day) order by killID desc limit 1", array(":id" => $id), 3600); |
||
637 | if (sizeof($data) == 0) |
||
638 | { |
||
639 | $data = Db::queryRow("select characterID, corporationID, allianceID, 0 factionID from zz_characters where characterID = :id", array(":id" => $id)); |
||
640 | } |
||
641 | if (sizeof($data) == 0) |
||
642 | { |
||
643 | $data["characterID"] = $id; |
||
644 | $data["valid"] = false; |
||
645 | return $data; |
||
646 | } |
||
647 | self::addInfo($data); |
||
648 | if (isset($data["corporationID"])) $data["isCEO"] = Db::queryField("select count(*) count from zz_corporations where ceoID = :charID and corporationID = :corpID", "count", array(":charID" => $id, ":corpID" => $data["corporationID"])); |
||
649 | else $data["isCEO"] = false; |
||
650 | if ($data["isCEO"] && $data["allianceID"] != 0) { |
||
651 | $data["isExecutorCEO"] = Db::queryField("select count(*) count from zz_alliances where executorCorpID = :corpID and allianceID = :alliID", "count", array(":corpID" => $data["corporationID"], ":alliID" => $data["allianceID"])); |
||
652 | } else $data["isExecutorCEO"] = 0; |
||
653 | return $parameters == null ? $data : Summary::getPilotSummary($data, $id, $parameters); |
||
654 | } |
||
655 | |||
656 | /** |
||
657 | * [addCorp description] |
||
658 | * @param int $id |
||
659 | * @param string $name |
||
660 | */ |
||
661 | public static function addCorp($id, $name) |
||
662 | { |
||
663 | if ($id <= 0) return; |
||
664 | $exists = Db::queryField("select count(1) count from zz_corporations where corporationID = :id", "count", array(":id" => $id)); |
||
665 | if ($exists == 0) Db::execute("insert ignore into zz_corporations (corporationID, name) values (:id, :name)", array(":id" => $id, ":name" => $name)); |
||
666 | StatsD::increment("corporation_Added"); |
||
667 | } |
||
668 | |||
669 | /** |
||
670 | * [getCorpDetails description] |
||
671 | * @param int $id |
||
672 | * @param array $parameters |
||
673 | * @return array |
||
674 | */ |
||
675 | public static function getCorpDetails($id, $parameters = array()) |
||
676 | { |
||
677 | $data = Db::queryRow("select corporationID, allianceID, factionID from zz_participants where corporationID = :id and dttm >= date_sub(now(), interval 7 day) order by killID desc limit 1", array(":id" => $id), 3600); |
||
678 | if (sizeof($data) == 0) $data = Db::queryRow("select corporationID, allianceID, 0 factionID from zz_corporations where corporationID = :id", array(":id" => $id), 3600); |
||
679 | if (sizeof($data) == 0) $data["corporationID"] = $id; |
||
680 | $moreData = Db::queryRow("select * from zz_corporations where corporationID = :id", array(":id" => $id), 3600); |
||
681 | if ($moreData) { |
||
682 | $data["memberCount"] = $moreData["memberCount"]; |
||
683 | $data["cticker"] = $moreData["ticker"]; |
||
684 | $data["ceoID"] = $moreData["ceoID"]; |
||
685 | } |
||
686 | self::addInfo($data); |
||
687 | return Summary::getCorpSummary($data, $id, $parameters); |
||
688 | } |
||
689 | |||
690 | /** |
||
691 | * [getAlliDetails description] |
||
692 | * @param int $id |
||
693 | * @param array $parameters |
||
694 | * @return array |
||
695 | */ |
||
696 | public static function getAlliDetails($id, $parameters = array()) |
||
697 | { |
||
698 | $data = Db::queryRow("select allianceID, factionID from zz_participants where allianceID = :id and dttm >= date_sub(now(), interval 7 day) order by killID desc limit 1", array(":id" => $id), 3600); |
||
699 | if (sizeof($data) == 0) $data["allianceID"] = $id; |
||
700 | // Add membercount, etc. |
||
701 | $moreData = Db::queryRow("select * from zz_alliances where allianceID = :id", array(":id" => $id), 3600); |
||
702 | if ($moreData) { |
||
703 | $data["memberCount"] = $moreData["memberCount"]; |
||
704 | $data["aticker"] = $moreData["ticker"]; |
||
705 | $data["executorCorpID"] = $moreData["executorCorpID"]; |
||
706 | } |
||
707 | self::addInfo($data); |
||
708 | return Summary::getAlliSummary($data, $id, $parameters); |
||
709 | } |
||
710 | |||
711 | /** |
||
712 | * [getFactionDetails description] |
||
713 | * @param int $id |
||
714 | * @return array |
||
715 | */ |
||
716 | public static function getFactionDetails($id, $parameters = array()) |
||
717 | { |
||
718 | $data["factionID"] = $id; |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
$data was never initialized. Although not strictly required by PHP, it is generally a good practice to add $data = array(); before regardless.
Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code. Let’s take a look at an example: foreach ($collection as $item) {
$myArray['foo'] = $item->getFoo();
if ($item->hasBar()) {
$myArray['bar'] = $item->getBar();
}
// do something with $myArray
}
As you can see in this example, the array This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop. ![]() |
|||
719 | self::addInfo($data); |
||
720 | return Summary::getFactionSummary($data, $id, $parameters); |
||
721 | } |
||
722 | |||
723 | /** |
||
724 | * [getSystemDetails description] |
||
725 | * @param int $id |
||
726 | * @return array |
||
727 | */ |
||
728 | public static function getSystemDetails($id, $parameters = array()) |
||
729 | { |
||
730 | $data = array("solarSystemID" => $id); |
||
731 | self::addInfo($data); |
||
732 | return Summary::getSystemSummary($data, $id, $parameters); |
||
733 | } |
||
734 | |||
735 | /** |
||
736 | * [getRegionDetails description] |
||
737 | * @param int $id |
||
738 | * @return array |
||
739 | */ |
||
740 | public static function getRegionDetails($id, $parameters = array()) |
||
741 | { |
||
742 | $data = array("regionID" => $id); |
||
743 | self::addInfo($data); |
||
744 | return Summary::getRegionSummary($data, $id, $parameters); |
||
745 | } |
||
746 | |||
747 | /** |
||
748 | * [getGroupDetails description] |
||
749 | * @param int $id |
||
750 | * @return array |
||
751 | */ |
||
752 | public static function getGroupDetails($id) |
||
753 | { |
||
754 | $data = array("groupID" => $id); |
||
755 | self::addInfo($data); |
||
756 | return Summary::getGroupSummary($data, $id); |
||
757 | } |
||
758 | |||
759 | /** |
||
760 | * [getShipDetails description] |
||
761 | * @param int $id |
||
762 | * @return array |
||
763 | */ |
||
764 | public static function getShipDetails($id) |
||
765 | { |
||
766 | $data = array("shipTypeID" => $id); |
||
767 | self::addInfo($data); |
||
768 | $data["shipTypeName"] = $data["shipName"]; |
||
769 | return Summary::getShipSummary($data, $id); |
||
770 | } |
||
771 | |||
772 | /** |
||
773 | * [getSystemsInRegion description] |
||
774 | * @param int $id |
||
775 | * @return array |
||
776 | */ |
||
777 | public static function getSystemsInRegion($id) |
||
778 | { |
||
779 | $result = Db::query("select solarSystemID from ccp_systems where regionID = :id", array(":id" => $id), 3600); |
||
780 | $data = array(); |
||
781 | foreach ($result as $row) $data[] = $row["solarSystemID"]; |
||
782 | return $data; |
||
783 | } |
||
784 | |||
785 | /** |
||
786 | * [addInfo description] |
||
787 | * @param mixed $element |
||
788 | * @return array|null |
||
789 | */ |
||
790 | public static function addInfo(&$element) |
||
791 | { |
||
792 | if ($element == null) return; |
||
793 | foreach ($element as $key => $value) { |
||
794 | if (is_array($value)) $element[$key] = self::addInfo($value); |
||
795 | else if ($value != 0) switch ($key) { |
||
796 | case "lastChecked": |
||
797 | $element["lastCheckedTime"] = $value; |
||
798 | break; |
||
799 | case "cachedUntil": |
||
800 | $element["cachedUntilTime"] = $value; |
||
801 | break; |
||
802 | case "dttm": |
||
803 | $dttm = strtotime($value); |
||
804 | $element["ISO8601"] = date("c", $dttm); |
||
805 | $element["killTime"] = date("Y-m-d H:i", $dttm); |
||
806 | $element["MonthDayYear"] = date("F j, Y", $dttm); |
||
807 | break; |
||
808 | case "shipTypeID": |
||
809 | if (!isset($element["shipName"])) $element["shipName"] = self::getItemName($value); |
||
810 | if (!isset($element["groupID"])) $element["groupID"] = self::getGroupID($value); |
||
811 | if (!isset($element["groupName"])) $element["groupName"] = self::getGroupName($element["groupID"]); |
||
812 | break; |
||
813 | case "groupID": |
||
814 | if (!isset($element["groupName"])) $element["groupName"] = self::getGroupName($value); |
||
815 | if (!isset($element["groupShips"]) && !isset($element["noRecursion"])) $element["groupShips"] = Db::query("select typeID as shipTypeID, typeName as shipName, raceID, 1 as noRecursion from ccp_invTypes where groupID = :id and (groupID = 29 or (published = 1 and marketGroupID is not null)) order by raceID, marketGroupID, typeName", array (":id" => $value), 3600); |
||
816 | break; |
||
817 | case "executorCorpID": |
||
818 | $element["executorCorpName"] = self::getCorpName($value); |
||
819 | break; |
||
820 | case "ceoID": |
||
821 | $element["ceoName"] = self::getCharName($value); |
||
822 | break; |
||
823 | case "characterID": |
||
824 | $element["characterName"] = self::getCharName($value); |
||
825 | break; |
||
826 | case "corporationID": |
||
827 | $element["corporationName"] = self::getCorpName($value); |
||
828 | break; |
||
829 | case "allianceID": |
||
830 | $element["allianceName"] = self::getAlliName($value); |
||
831 | break; |
||
832 | case "factionID": |
||
833 | $element["factionName"] = self::getFactionName($value); |
||
834 | break; |
||
835 | case "weaponTypeID": |
||
836 | $element["weaponTypeName"] = self::getItemName($value); |
||
837 | break; |
||
838 | case "typeID": |
||
839 | if (!isset($element["typeName"])) $element["typeName"] = self::getItemName($value); |
||
840 | $groupID = self::getGroupID($value); |
||
841 | if (!isset($element["groupID"])) $element["groupID"] = $groupID; |
||
842 | if (!isset($element["groupName"])) $element["groupName"] = self::getGroupName($groupID); |
||
843 | if (Util::startsWith($element["groupName"], "Infantry ")) $element["fittable"] = true; |
||
844 | else if (!isset($element["fittable"])) $element["fittable"] = self::getEffectID($value) != null; |
||
845 | break; |
||
846 | case "solarSystemID": |
||
847 | $info = self::getSystemInfo($value); |
||
848 | if (sizeof($info)) { |
||
849 | $element["solarSystemName"] = $info["solarSystemName"]; |
||
850 | $element["sunTypeID"] = $info["sunTypeID"]; |
||
851 | $securityLevel = number_format($info["security"], 1); |
||
852 | if ($securityLevel == 0 && $info["security"] > 0) $securityLevel = 0.1; |
||
853 | $element["solarSystemSecurity"] = $securityLevel; |
||
854 | $element["systemColorCode"] = self::getSystemColorCode($securityLevel); |
||
855 | $regionInfo = self::getRegionInfoFromSystemID($value); |
||
856 | $element["regionID"] = $regionInfo["regionID"]; |
||
857 | $element["regionName"] = $regionInfo["regionName"]; |
||
858 | $wspaceInfo = self::getWormholeSystemInfo($value); |
||
859 | if ($wspaceInfo) { |
||
860 | $element["systemClass"] = $wspaceInfo["class"]; |
||
861 | $element["systemEffect"] = $wspaceInfo["effectName"]; |
||
862 | } |
||
863 | } |
||
864 | break; |
||
865 | case "regionID": |
||
866 | $element["regionName"] = self::getRegionName($value); |
||
867 | break; |
||
868 | case "flag": |
||
869 | $element["flagName"] = self::getFlagName($value); |
||
870 | break; |
||
871 | case "addDetail": |
||
872 | $info = Db::queryRow("select corporationID, allianceID from zz_participants where characterID = :c order by killID desc limit 1", |
||
873 | array(":c" => $value), 3600); |
||
874 | if (sizeof($info)) { |
||
875 | $element["corporationID"] = $info["corporationID"]; |
||
876 | if ($info["allianceID"]) $element["allianceID"] = $info["allianceID"]; |
||
877 | } |
||
878 | break; |
||
879 | } |
||
880 | } |
||
881 | return $element; |
||
882 | } |
||
883 | |||
884 | /** |
||
885 | * [getSystemColorCode description] |
||
886 | * @param int $securityLevel |
||
887 | * @return string |
||
888 | */ |
||
889 | public static function getSystemColorCode($securityLevel) |
||
890 | { |
||
891 | $sec = number_format($securityLevel, 1); |
||
892 | switch ($sec) { |
||
893 | case 1.0: |
||
894 | return "#33F9F9"; |
||
895 | case 0.9: |
||
896 | return "#4BF3C3"; |
||
897 | case 0.8: |
||
898 | return "#02F34B"; |
||
899 | case 0.7: |
||
900 | return "#00FF00"; |
||
901 | case 0.6: |
||
902 | return "#96F933"; |
||
903 | case 0.5: |
||
904 | return "#F5F501"; |
||
905 | case 0.4: |
||
906 | return "#E58000"; |
||
907 | case 0.3: |
||
908 | return "#F66301"; |
||
909 | case 0.2: |
||
910 | return "#EB4903"; |
||
911 | case 0.1: |
||
912 | return "#DC3201"; |
||
913 | default: |
||
914 | case 0.0: |
||
915 | return "#F30202"; |
||
916 | } |
||
917 | return ""; |
||
918 | } |
||
919 | |||
920 | |||
921 | public static $effectFitToSlot = array( |
||
922 | "12" => "High Slots", |
||
923 | "13" => "Mid Slots", |
||
924 | "11" => "Low Slots", |
||
925 | "2663" => "Rigs", |
||
926 | "3772" => "SubSystems", |
||
927 | "87" => "Drone Bay",); |
||
928 | |||
929 | /** |
||
930 | * [$effectToSlot description] |
||
931 | * @var array |
||
932 | */ |
||
933 | public static $effectToSlot = array( |
||
934 | "12" => "High Slots", |
||
935 | "13" => "Mid Slots", |
||
936 | "11" => "Low Slots", |
||
937 | "2663" => "Rigs", |
||
938 | "3772" => "SubSystems", |
||
939 | "87" => "Drone Bay", |
||
940 | "5" => "Cargo", |
||
941 | "4" => "Corporate Hangar", |
||
942 | "0" => "Corporate Hangar", // Yes, two spaces, flag 0 is wierd and should be 4 |
||
943 | "89" => "Implants", |
||
944 | "133" => "Fuel Bay", |
||
945 | "134" => "Ore Hold", |
||
946 | "136" => "Mineral Hold", |
||
947 | "137" => "Salvage Hold", |
||
948 | "138" => "Specialized Ship Hold", |
||
949 | "90" => "Ship Hangar", |
||
950 | "148" => "Command Center Hold", |
||
951 | "149" => "Planetary Commodities Hold", |
||
952 | "151" => "Material Bay", |
||
953 | "154" => "Quafe Bay", |
||
954 | "155" => "Fleet Hangar", |
||
955 | ); |
||
956 | |||
957 | /** |
||
958 | * [$infernoFlags description] |
||
959 | * @var array |
||
960 | */ |
||
961 | private static $infernoFlags = array( |
||
962 | 4 => array(116, 121), |
||
963 | 12 => array(27, 34), // Highs |
||
964 | 13 => array(19, 26), // Mids |
||
965 | 11 => array(11, 18), // Lows |
||
966 | 2663 => array(92, 98), // Rigs |
||
967 | 3772 => array(125, 132), // Subs |
||
968 | ); |
||
969 | |||
970 | /** |
||
971 | * [getFlagName description] |
||
972 | * @param string $flag |
||
973 | * @return string |
||
974 | */ |
||
975 | public static function getFlagName($flag) |
||
976 | { |
||
977 | // Assuming Inferno Flags |
||
978 | $flagGroup = 0; |
||
979 | foreach (self::$infernoFlags as $infernoFlagGroup => $array) { |
||
980 | $low = $array[0]; |
||
981 | $high = $array[1]; |
||
982 | if ($flag >= $low && $flag <= $high) $flagGroup = $infernoFlagGroup; |
||
983 | if ($flagGroup != 0) return self::$effectToSlot["$flagGroup"]; |
||
984 | } |
||
985 | if ($flagGroup == 0 && array_key_exists($flag, self::$effectToSlot)) return self::$effectToSlot["$flag"]; |
||
986 | if ($flagGroup == 0 && $flag == 0) return "Corporate Hangar"; |
||
987 | if ($flagGroup == 0) return null; |
||
988 | return self::$effectToSlot["$flagGroup"]; |
||
989 | } |
||
990 | |||
991 | /** |
||
992 | * [getSlotCounts description] |
||
993 | * @param int $shipTypeID |
||
994 | * @return array |
||
995 | */ |
||
996 | public static function getSlotCounts($shipTypeID) |
||
997 | { |
||
998 | $result = Db::query("select attributeID, valueInt, valueFloat from ccp_dgmTypeAttributes where typeID = :typeID and attributeID in (12, 13, 14, 1137)", |
||
999 | array(":typeID" => $shipTypeID), 86400); |
||
1000 | $slotArray = array(); |
||
1001 | foreach ($result as $row) { |
||
1002 | if($row["valueInt"] == NULL && $row["valueFloat"] != NULL) |
||
1003 | $value = $row["valueFloat"]; |
||
1004 | elseif($row["valueInt"] != NULL && $row["valueFloat"] == NULL) |
||
1005 | $value = $row["valueInt"]; |
||
1006 | else |
||
1007 | $value = NULL; |
||
1008 | |||
1009 | if ($row["attributeID"] == 12) $slotArray["lowSlotCount"] = $value; |
||
1010 | else if ($row["attributeID"] == 13) $slotArray["midSlotCount"] = $value; |
||
1011 | else if ($row["attributeID"] == 14) $slotArray["highSlotCount"] = $value; |
||
1012 | else if ($row["attributeID"] == 1137) $slotArray["rigSlotCount"] = $value; |
||
1013 | } |
||
1014 | return $slotArray; |
||
1015 | } |
||
1016 | |||
1017 | /** |
||
1018 | * @param string $title |
||
1019 | * @param string $field |
||
1020 | * @param array $array |
||
1021 | */ |
||
1022 | public static function doMakeCommon($title, $field, $array) { |
||
1023 | $retArray = array(); |
||
1024 | $retArray["type"] = str_replace("ID", "", $field); |
||
1025 | $retArray["title"] = $title; |
||
1026 | $retArray["values"] = array(); |
||
1027 | foreach($array as $row) { |
||
1028 | $data = $row; |
||
1029 | $data["id"] = $row[$field]; |
||
1030 | if (isset($row[$retArray["type"] . "Name"])) $data["name"] = $row[$retArray["type"] . "Name"]; |
||
1031 | else if(isset($row["shipName"])) $data["name"] = $row["shipName"]; |
||
1032 | $data["kills"] = $row["kills"]; |
||
1033 | $retArray["values"][] = $data; |
||
1034 | } |
||
1035 | return $retArray; |
||
1036 | } |
||
1037 | } |
||
1038 |
This check looks for accesses to local static members using the fully qualified name instead of
self::
.While this is perfectly valid, the fully qualified name of
Certificate::TRIPLEDES_CBC
could just as well be replaced byself::TRIPLEDES_CBC
. Referencing local members withself::
assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.