DomCI : Update all the PHPDoc

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3279 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2016-12-09 14:47:48 +00:00
parent b102168208
commit b55ea95fae
21 changed files with 953 additions and 424 deletions

View File

@@ -6,7 +6,9 @@
/** Manage the IP addresses conversions */
class ipaddresses
{
/** Return true if the provided IP address is valid (IPv4 or IPv6) */
/** Return true if the provided IP address is valid (IPv4 or IPv6)
* @param string $ip The IP Address to validate
*/
public function validIPAddress ($ip)
{
if (!is_string ($ip) || $ip === "")
@@ -19,7 +21,9 @@ class ipaddresses
return $rc;
}
/** Return true if the provided IP address is valid and is IPv4 */
/** Return true if the provided IP address is valid and is IPv4
* @param string $ip The IP Address to validate
*/
public function validIPv4Address ($ip)
{
if (!is_string ($ip) || $ip === "")
@@ -31,7 +35,9 @@ class ipaddresses
return TRUE;
}
/** Return true if the provided IP address is valid and is IPv6 */
/** Return true if the provided IP address is valid and is IPv6
* @param string $ip The IP Address to validate
*/
public function validIPv6Address ($ip)
{
if (!is_string ($ip) || $ip === "")
@@ -44,10 +50,12 @@ class ipaddresses
}
/** Return the IPv6 uncompressed (all the fields exists). They are not filled
by zeros
If the provided IP is IPv4, there is no change applied
Return False if the parameter is invalid
Based on http://www.weberdev.com/get_example.php3?ExampleID=3921 */
* by zeros
* If the provided IP is IPv4, there is no change applied
* Return False if the parameter is invalid
* Based on http://www.weberdev.com/get_example.php3?ExampleID=3921
* @param string $ip The IP address to uncompress
*/
public function uncompressIPv6 ($ip)
{
if (! is_string ($ip) || $ip === "")
@@ -80,11 +88,13 @@ class ipaddresses
return $ip;
}
/* Get an IPv6 address with the format
x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x
and return it with format
xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx
Return false if the IP provided is not complete */
/** Get an IPv6 address with the format
* x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x
* and return it with format
* xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx
* Return false if the IP provided is not complete
* @param string $ipv6 The IPv6 to group
*/
public function groupIPv6 ($ipv6)
{
if (! is_string ($ipv6) || $ipv6 === "")
@@ -106,9 +116,11 @@ class ipaddresses
return $new;
}
/* Return the IP adddress with filling the fields with the missing zeros.
Valid only on IPv6 (but don't change anything if the provided address is
IPv4) */
/** Return the IP adddress with filling the fields with the missing zeros.
* Valid only on IPv6 (but don't change anything if the provided address is
* IPv4)
* @param string $ip The IP to complete
*/
public function completeAddressWithZero ($ip)
{
if (! is_string ($ip) || $ip === "")
@@ -139,8 +151,11 @@ class ipaddresses
throw new \Exception (dgettext("domframework", "Invalid IP address"), 500);
}
/* Return the provided CIDR in binary. Length must be in bytes.
Return FALSE if the parameters are invalid */
/** Return the provided CIDR in binary. Length must be in bytes.
* Return FALSE if the parameters are invalid
* @param integer $cidr The CIDR to convert
* @param integer $length The length to use
*/
public function cidrToBin ($cidr, $length)
{
if (! is_numeric ($cidr) || $cidr < 0 || $cidr > 128)
@@ -156,8 +171,14 @@ class ipaddresses
return pack ('H*', $this->str_base_convert ($val, 2, 16));
}
/* Base conversion with 128 bits support for IPv6
Based on http://fr2.php.net/manual/en/function.base-convert.php#109660 */
/** Base conversion with 128 bits support for IPv6
* Based on http://fr2.php.net/manual/en/function.base-convert.php#109660
* @param string $str The string to convert
* @param integer|null $frombase The base of the provided string (10 by
* default)
* @param integer|null $tobase The base of the returned string (36 by
* default)
*/
public function str_base_convert($str, $frombase=10, $tobase=36)
{
$str = trim ($str);
@@ -194,9 +215,11 @@ class ipaddresses
return $s;
}
/* Reverse the provided IP address
The IPv6 are returned in format :
x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x */
/** Reverse the provided IP address
* The IPv6 are returned in format :
* x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x
* @param string $ipReverse The IPv6 to reverse
*/
function reverseIPAddress ($ipReverse)
{
if (!is_string ($ipReverse) || $ipReverse === "")
@@ -229,10 +252,12 @@ class ipaddresses
throw new \Exception (dgettext("domframework", "Invalid IP address"), 500);
}
/* This function return the CIDR associated to the provided netmask
Ex. Return 24 for a mask 255.255.255.0
Work only in IPv4
Return FALSE if the provided IP is invalid */
/** This function return the CIDR associated to the provided netmask
* Ex. Return 24 for a mask 255.255.255.0
* Work only in IPv4
* Return FALSE if the provided IP is invalid
* @param string $netmask The mask to convert in CIDR
*/
public function netmask2cidr ($netmask)
{
$netmask = ip2long ($netmask);