Skip to content

Commit

Permalink
QA (#7).
Browse files Browse the repository at this point in the history
Some minor optimisations plus removal of some unused variable
declarations (thank you to @guytomer for spotting these).
  • Loading branch information
Maikuolan committed Feb 8, 2020
1 parent 8d64b22 commit ffedc6a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Aggregator.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Aggregator v1.3.1 (last modified: 2020.02.05).
* Aggregator v1.3.1 (last modified: 2020.02.08).
*
* Description: A stand-alone class implementation of the IPv4+IPv6 IP+CIDR
* aggregator from CIDRAM.
Expand Down Expand Up @@ -334,6 +334,7 @@ private function stripInvalidCharactersAndSort(&$In)
}
return $Compare < 0 ? -1 : 1;
});

$In = implode("\n", $In);
}

Expand Down Expand Up @@ -397,10 +398,8 @@ private function stripInvalidRangesAndSubs(&$In)
}
if (($Size > 0 && $Size <= 32) && ($CIDRs = $this->ExpandIPv4($CIDR, false, $Size - 1))) {
$Type = 4;
$Ranges = 32;
} elseif (($Size > 0 && $Size <= 128) && ($CIDRs = $this->ExpandIPv6($CIDR, false, $Size - 1))) {
$Type = 6;
$Ranges = 128;
} else {
$Out = str_replace("\n" . $Line . "\n", "\n", $Out);
continue;
Expand Down Expand Up @@ -439,7 +438,7 @@ private function mergeRanges(&$In)
}
$In = $Out = "\n" . $In . "\n";
$Size = $Offset = 0;
$CIDR = $Line = '';
$Line = '';
$CIDRs = false;
while (($NewLine = strpos($In, "\n", $Offset)) !== false) {
if (isset($this->callbacks['newTick']) && is_callable($this->callbacks['newTick'])) {
Expand Down

0 comments on commit ffedc6a

Please sign in to comment.