Completed
Pull Request — master (#8100)
by Tony
05:26
created
includes/functions.php 1 patch
Doc Comments   +45 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,6 +34,9 @@  discard block
 block discarded – undo
34 34
     }
35 35
 }//end set_debug()
36 36
 
37
+/**
38
+ * @param string $on
39
+ */
37 40
 function array_sort($array, $on, $order = SORT_ASC)
38 41
 {
39 42
     $new_array = array();
@@ -68,6 +71,9 @@  discard block
 block discarded – undo
68 71
     return $new_array;
69 72
 }
70 73
 
74
+/**
75
+ * @param string $mac
76
+ */
71 77
 function mac_clean_to_readable($mac)
72 78
 {
73 79
     return rtrim(chunk_split($mac, 2, ':'), ':');
@@ -335,6 +341,9 @@  discard block
 block discarded – undo
335 341
     return $device['icon'] ? str_replace(array('.svg', '.png'), '', $device['icon']) : $device['os'];
336 342
 }
337 343
 
344
+/**
345
+ * @return string
346
+ */
338 347
 function getImageName($device, $use_database = true, $dir = 'images/os/')
339 348
 {
340 349
     global $config;
@@ -545,6 +554,10 @@  discard block
 block discarded – undo
545 554
     throw $host_unreachable_exception;
546 555
 }
547 556
 
557
+/**
558
+ * @param string $host
559
+ * @param string $snmpver
560
+ */
548 561
 function deviceArray($host, $community, $snmpver, $port = 161, $transport = 'udp', $v3 = array(), $port_assoc_mode = 'ifIndex')
549 562
 {
550 563
     $device = array();
@@ -789,6 +802,9 @@  discard block
 block discarded – undo
789 802
     throw new \Exception("Failed to add host to the database, please run ./validate.php");
790 803
 }
791 804
 
805
+/**
806
+ * @param string $domain
807
+ */
792 808
 function isDomainResolves($domain)
793 809
 {
794 810
     if (gethostbyname($domain) != $domain) {
@@ -1008,12 +1024,18 @@  discard block
 block discarded – undo
1008 1024
 }
1009 1025
 
1010 1026
 # Convert an SNMP hex string to regular string
1027
+/**
1028
+ * @param string $hex
1029
+ */
1011 1030
 function snmp_hexstring($hex)
1012 1031
 {
1013 1032
     return hex2str(str_replace(' ', '', str_replace(' 00', '', $hex)));
1014 1033
 }
1015 1034
 
1016 1035
 # Check if the supplied string is an SNMP hex string
1036
+/**
1037
+ * @param string $str
1038
+ */
1017 1039
 function isHexString($str)
1018 1040
 {
1019 1041
     return (bool)preg_match("/^[a-f0-9][a-f0-9]( [a-f0-9][a-f0-9])*$/is", trim($str));
@@ -1179,6 +1201,9 @@  discard block
 block discarded – undo
1179 1201
     }
1180 1202
 }
1181 1203
 
1204
+/**
1205
+ * @param string $json
1206
+ */
1182 1207
 function _json_format($json, $options = 448)
1183 1208
 {
1184 1209
     $prettyPrint = (bool) ($options & JSON_PRETTY_PRINT);
@@ -1220,6 +1245,10 @@  discard block
 block discarded – undo
1220 1245
                 // http://stackoverflow.com/questions/2934563/how-to-decode-unicode-escape-sequences-like-u00ed-to-proper-utf-8-encoded-cha
1221 1246
                 $buffer = preg_replace_callback(
1222 1247
                     '/\\\\u([0-9a-f]{4})/i',
1248
+
1249
+                    /**
1250
+                     * @param string $match
1251
+                     */
1223 1252
                     function ($match) {
1224 1253
                         return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
1225 1254
                     },
@@ -1279,6 +1308,9 @@  discard block
 block discarded – undo
1279 1308
     return $result;
1280 1309
 }
1281 1310
 
1311
+/**
1312
+ * @param string $delay
1313
+ */
1282 1314
 function convert_delay($delay)
1283 1315
 {
1284 1316
     $delay = preg_replace('/\s/', '', $delay);
@@ -1309,7 +1341,7 @@  discard block
 block discarded – undo
1309 1341
 }
1310 1342
 
1311 1343
 /**
1312
- * @param $curl
1344
+ * @param resource $curl
1313 1345
  */
1314 1346
 function set_curl_proxy($curl)
1315 1347
 {
@@ -1325,7 +1357,7 @@  discard block
 block discarded – undo
1325 1357
 /**
1326 1358
  * Return the proxy url
1327 1359
  *
1328
- * @return array|bool|false|string
1360
+ * @return string
1329 1361
  */
1330 1362
 function get_proxy()
1331 1363
 {
@@ -1384,6 +1416,9 @@  discard block
 block discarded – undo
1384 1416
     return $return;
1385 1417
 }
1386 1418
 
1419
+/**
1420
+ * @param string $ip
1421
+ */
1387 1422
 function ip_exists($ip)
1388 1423
 {
1389 1424
     // Function to check if an IP exists in the DB already
@@ -1399,6 +1434,11 @@  discard block
 block discarded – undo
1399 1434
     return false;
1400 1435
 }
1401 1436
 
1437
+/**
1438
+ * @param string $host
1439
+ * @param string $params
1440
+ * @param integer $address_family
1441
+ */
1402 1442
 function fping($host, $params, $address_family = AF_INET)
1403 1443
 {
1404 1444
 
@@ -1451,6 +1491,9 @@  discard block
 block discarded – undo
1451 1491
     return $response;
1452 1492
 }
1453 1493
 
1494
+/**
1495
+ * @param string $function
1496
+ */
1454 1497
 function function_check($function)
1455 1498
 {
1456 1499
     return function_exists($function);
Please login to merge, or discard this patch.