Apply fixes from StyleCI (#12117)

* Apply fixes from StyleCI

* Disable style check
This commit is contained in:
Jellyfrog
2020-09-21 14:54:51 +02:00
committed by GitHub
parent 8ec9183df5
commit 77c531527c
752 changed files with 6238 additions and 5833 deletions

View File

@@ -37,9 +37,9 @@ class IPv4 extends IP
public function __construct($ipv4)
{
$this->host_bits = 32;
list($this->ip, $this->cidr) = $this->extractCidr($ipv4);
[$this->ip, $this->cidr] = $this->extractCidr($ipv4);
if (!self::isValid($this->ip)) {
if (! self::isValid($this->ip)) {
throw new InvalidIpException("$ipv4 is not a valid ipv4 address");
}
}
@@ -69,7 +69,8 @@ class IPv4 extends IP
{
$long = ip2long($netmask);
$base = ip2long('255.255.255.255');
return (int)(32 - log(($long ^ $base) + 1, 2));
return (int) (32 - log(($long ^ $base) + 1, 2));
}
/**
@@ -87,7 +88,7 @@ class IPv4 extends IP
*/
private function cidr2long($cidr)
{
return -1 << (32 - (int)$cidr);
return -1 << (32 - (int) $cidr);
}
/**
@@ -97,13 +98,14 @@ class IPv4 extends IP
*/
public function inNetwork($network)
{
list($net, $cidr) = $this->extractCidr($network);
if (!self::isValid($net)) {
[$net, $cidr] = $this->extractCidr($network);
if (! self::isValid($net)) {
return false;
}
$mask = $this->cidr2long($cidr);
return ((ip2long($this->ip) & $mask) == (ip2long($net) & $mask));
return (ip2long($this->ip) & $mask) == (ip2long($net) & $mask);
}
/**
@@ -127,6 +129,6 @@ class IPv4 extends IP
*/
public function toSnmpIndex()
{
return (string)$this->ip;
return (string) $this->ip;
}
}