Skip to content

Commit

Permalink
Code-style patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
Maikuolan committed Oct 23, 2021
1 parent b63d475 commit 534e446
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Aggregator.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Aggregator v1.3.3 (last modified: 2021.10.22).
* Aggregator v1.3.3 (last modified: 2021.10.23).
*
* Description: A stand-alone class implementation of the IPv4+IPv6 IP+CIDR
* aggregator from CIDRAM.
Expand Down Expand Up @@ -81,7 +81,9 @@ class Aggregator
private $TableIPv6Netmask = [];

/**
* @var int Specifies the format to use for Aggregator output. 0 = CIDR notation [default]. 1 = Netmask notation.
* @var int Specifies the format to use for Aggregator output.
* 0 = CIDR notation [default].
* 1 = Netmask notation.
*/
private $Mode = 0;

Expand Down Expand Up @@ -247,16 +249,16 @@ public function ExpandIPv6($Addr, $ValidateOnly = false, $FactorLimit = 128)
}
foreach ($CIDRs as &$CIDR) {
if (strpos($CIDR, '::') !== false) {
$CIDR = preg_replace('~(?:\:0)*\:\:(?:0\:)*~i', '::', $CIDR, 1);
$CIDR = preg_replace('~(?::0)*::(?:0:)*~i', '::', $CIDR, 1);
$CIDR = str_replace('::0/', '::/', $CIDR);
continue;
}
if (strpos($CIDR, ':0:0/') !== false) {
$CIDR = preg_replace('~(\:0){2,}\/~i', '::/', $CIDR, 1);
$CIDR = preg_replace('~(:0){2,}\/~i', '::/', $CIDR, 1);
continue;
}
if (strpos($CIDR, ':0:0:') !== false) {
$CIDR = preg_replace('~(\:0)+\:(0\:)+~i', '::', $CIDR, 1);
$CIDR = preg_replace('~(:0)+:(0:)+~i', '::', $CIDR, 1);
$CIDR = str_replace('::0/', '::/', $CIDR);
continue;
}
Expand Down

0 comments on commit 534e446

Please sign in to comment.