11<?php
22/**
3- * Aggregator v1.3.5 (last modified: 2026.03.17).
3+ * Aggregator v1.3.6 (last modified: 2026.03.17).
44 * @link https://github.com/CIDRAM/Aggregator
55 *
66 * Description: A stand-alone class implementation of the IPv4+IPv6 IP+CIDR
@@ -187,17 +187,17 @@ private function stripInvalidCharactersAndSort()
187187 if (!\is_array ($ this ->Output )) {
188188 $ this ->Output = \explode ("\n" , \strtolower (\trim (\str_replace ("\r" , '' , $ this ->Output ))));
189189 }
190- $ Count = count ($ this ->Output );
191- if (isset ($ this ->callbacks ['newParse ' ]) && \is_callable ($ this ->callbacks ['newParse ' ])) {
190+ $ Count = \ count ($ this ->Output );
191+ if (\ isset ($ this ->callbacks ['newParse ' ]) && \is_callable ($ this ->callbacks ['newParse ' ])) {
192192 $ this ->callbacks ['newParse ' ]($ Count );
193193 }
194- if (!empty ($ this ->Results )) {
194+ if (!\ empty ($ this ->Results )) {
195195 $ this ->NumberEntered += $ Count ;
196196 }
197197 unset($ Count );
198198 $ this ->Output = \array_filter (\array_unique (\array_map (function ($ Line ) {
199199 $ Line = \preg_replace ('~^(?:(?:#| \*|/\*).*|[^\dA-Fa-f:./]*)|(?:[ \t].*|[^\dA-Fa-f:./]*)$~ ' , '' , $ Line );
200- if (isset ($ this ->callbacks ['newTick ' ]) && \is_callable ($ this ->callbacks ['newTick ' ])) {
200+ if (\ isset ($ this ->callbacks ['newTick ' ]) && \is_callable ($ this ->callbacks ['newTick ' ])) {
201201 $ this ->callbacks ['newTick ' ]();
202202 }
203203 return ($ Line === '' || \preg_match ('~[^\da-f:./]+~i ' , $ Line )) ? '' : $ Line ;
@@ -216,9 +216,9 @@ private function stripInvalidCharactersAndSort()
216216 $ AType = 6 ;
217217 }
218218 $ A = $ AType ? \inet_pton ($ A ) : false ;
219- if ($ AType === 4 && isset ($ this ->TableIPv4Netmask [$ ASize ])) {
219+ if ($ AType === 4 && \ isset ($ this ->TableIPv4Netmask [$ ASize ])) {
220220 $ ASize = $ this ->TableIPv4Netmask [$ ASize ];
221- } elseif ($ AType === 6 && isset ($ this ->TableIPv6Netmask [$ ASize ])) {
221+ } elseif ($ AType === 6 && \ isset ($ this ->TableIPv6Netmask [$ ASize ])) {
222222 $ ASize = $ this ->TableIPv6Netmask [$ ASize ];
223223 } else {
224224 $ ASize = (int )$ ASize ;
@@ -239,9 +239,9 @@ private function stripInvalidCharactersAndSort()
239239 $ BType = 6 ;
240240 }
241241 $ B = $ BType ? \inet_pton ($ B ) : false ;
242- if ($ BType === 4 && isset ($ this ->TableIPv4Netmask [$ BSize ])) {
242+ if ($ BType === 4 && \ isset ($ this ->TableIPv4Netmask [$ BSize ])) {
243243 $ BSize = $ this ->TableIPv4Netmask [$ BSize ];
244- } elseif ($ BType === 6 && isset ($ this ->TableIPv6Netmask [$ BSize ])) {
244+ } elseif ($ BType === 6 && \ isset ($ this ->TableIPv6Netmask [$ BSize ])) {
245245 $ BSize = $ this ->TableIPv6Netmask [$ BSize ];
246246 } else {
247247 $ BSize = (int )$ BSize ;
@@ -277,7 +277,7 @@ private function stripInvalidCharactersAndSort()
277277 */
278278 private function stripInvalidRangesAndSubs ()
279279 {
280- if (isset ($ this ->callbacks ['newParse ' ]) && \is_callable ($ this ->callbacks ['newParse ' ])) {
280+ if (\ isset ($ this ->callbacks ['newParse ' ]) && \is_callable ($ this ->callbacks ['newParse ' ])) {
281281 $ this ->callbacks ['newParse ' ](\substr_count ($ this ->Output , "\n" ));
282282 }
283283 $ this ->Output = $ Out = "\n" . $ this ->Output . "\n" ;
@@ -304,7 +304,7 @@ private function stripInvalidRangesAndSubs()
304304 }
305305 unset($ Lows );
306306 while (($ NewLine = \strpos ($ this ->Output , "\n" , $ Offset )) !== false ) {
307- if (isset ($ this ->callbacks ['newTick ' ]) && \is_callable ($ this ->callbacks ['newTick ' ])) {
307+ if (\ isset ($ this ->callbacks ['newTick ' ]) && \is_callable ($ this ->callbacks ['newTick ' ])) {
308308 $ this ->callbacks ['newTick ' ]();
309309 }
310310 $ Line = \substr ($ this ->Output , $ Offset , $ NewLine - $ Offset );
@@ -315,9 +315,9 @@ private function stripInvalidRangesAndSubs()
315315 if (($ RangeSep = \strpos ($ Line , '/ ' )) !== false ) {
316316 $ Size = \substr ($ Line , $ RangeSep + 1 );
317317 if (\strpos ($ Size , '. ' ) !== false ) {
318- $ Size = isset ($ this ->TableIPv4Netmask [$ Size ]) ? $ this ->TableIPv4Netmask [$ Size ] : 0 ;
318+ $ Size = \ isset ($ this ->TableIPv4Netmask [$ Size ]) ? $ this ->TableIPv4Netmask [$ Size ] : 0 ;
319319 } elseif (\strpos ($ Size , ': ' ) !== false ) {
320- $ Size = isset ($ this ->TableIPv6Netmask [$ Size ]) ? $ this ->TableIPv6Netmask [$ Size ] : 0 ;
320+ $ Size = \ isset ($ this ->TableIPv6Netmask [$ Size ]) ? $ this ->TableIPv6Netmask [$ Size ] : 0 ;
321321 } else {
322322 $ Size = (int )$ Size ;
323323 }
@@ -340,25 +340,25 @@ private function stripInvalidRangesAndSubs()
340340 $ Out = \str_replace ("\n" . $ Line . "\n" , "\n" , $ Out );
341341 continue ;
342342 }
343- if (!isset ($ CIDRs [$ Size - 1 ]) || $ CIDRs [$ Size - 1 ] !== $ CIDR . '/ ' . $ Size ) {
343+ if (!\ isset ($ CIDRs [$ Size - 1 ]) || $ CIDRs [$ Size - 1 ] !== $ CIDR . '/ ' . $ Size ) {
344344 $ Out = \str_replace ("\n" . $ Line . "\n" , "\n" , $ Out );
345345 continue ;
346346 }
347347 $ Out = \str_replace ("\n" . $ Line . "\n" , "\n" . $ CIDRs [$ Size - 1 ] . "\n" , $ Out );
348348 $ ThisLow = ($ Type === 4 ? $ Low [4 ] : $ Low [6 ]) - 1 ;
349349 for ($ Range = $ Size - 2 ; $ Range >= $ ThisLow ; $ Range --) {
350- if (isset ($ CIDRs [$ Range ]) && \strpos ($ Out , "\n" . $ CIDRs [$ Range ] . "\n" ) !== false ) {
350+ if (\ isset ($ CIDRs [$ Range ]) && \strpos ($ Out , "\n" . $ CIDRs [$ Range ] . "\n" ) !== false ) {
351351 $ Out = \str_replace ("\n" . $ CIDRs [$ Size - 1 ] . "\n" , "\n" , $ Out );
352- if (!empty ($ this ->Results )) {
352+ if (!\ empty ($ this ->Results )) {
353353 $ this ->NumberMerged ++;
354354 }
355355 break ;
356356 }
357357 }
358358 }
359359 $ this ->Output = \trim ($ Out );
360- if (!empty ($ this ->Results )) {
361- $ this ->NumberReturned += empty ($ this ->Output ) ? 0 : \substr_count ($ this ->Output , "\n" ) + 1 ;
360+ if (!\ empty ($ this ->Results )) {
361+ $ this ->NumberReturned += \ empty ($ this ->Output ) ? 0 : \substr_count ($ this ->Output , "\n" ) + 1 ;
362362 $ this ->NumberRejected = $ this ->NumberEntered - $ this ->NumberReturned - $ this ->NumberMerged ;
363363 $ this ->NumberAccepted = $ this ->NumberEntered - $ this ->NumberRejected ;
364364 }
@@ -373,15 +373,15 @@ private function mergeRanges()
373373 {
374374 while (true ) {
375375 $ Step = $ this ->Output ;
376- if (isset ($ this ->callbacks ['newParse ' ]) && \is_callable ($ this ->callbacks ['newParse ' ])) {
376+ if (\ isset ($ this ->callbacks ['newParse ' ]) && \is_callable ($ this ->callbacks ['newParse ' ])) {
377377 $ this ->callbacks ['newParse ' ](\substr_count ($ Step , "\n" ));
378378 }
379379 $ this ->Output = $ Out = "\n" . $ this ->Output . "\n" ;
380380 $ Size = $ Offset = 0 ;
381381 $ Line = '' ;
382382 $ CIDRs = false ;
383383 while (($ NewLine = \strpos ($ this ->Output , "\n" , $ Offset )) !== false ) {
384- if (isset ($ this ->callbacks ['newTick ' ]) && \is_callable ($ this ->callbacks ['newTick ' ])) {
384+ if (\ isset ($ this ->callbacks ['newTick ' ]) && \is_callable ($ this ->callbacks ['newTick ' ])) {
385385 $ this ->callbacks ['newTick ' ]();
386386 }
387387 $ PrevLine = $ Line ;
@@ -398,16 +398,16 @@ private function mergeRanges()
398398 if ($ Line === $ PrevLine ) {
399399 $ Out = \str_replace ("\n" . $ PrevLine . "\n" . $ Line . "\n" , "\n" . $ Line . "\n" , $ Out );
400400 } elseif (
401- !empty ($ CIDRs [$ Size - 1 ]) &&
402- !empty ($ PrevCIDRs [$ PrevSize - 1 ]) &&
403- !empty ($ CIDRs [$ Size - 2 ]) &&
404- !empty ($ PrevCIDRs [$ PrevSize - 2 ]) &&
401+ !\ empty ($ CIDRs [$ Size - 1 ]) &&
402+ !\ empty ($ PrevCIDRs [$ PrevSize - 1 ]) &&
403+ !\ empty ($ CIDRs [$ Size - 2 ]) &&
404+ !\ empty ($ PrevCIDRs [$ PrevSize - 2 ]) &&
405405 $ CIDRs [$ Size - 2 ] === $ PrevCIDRs [$ PrevSize - 2 ]
406406 ) {
407407 $ Out = \str_replace ("\n" . $ PrevLine . "\n" . $ Line . "\n" , "\n" . $ CIDRs [$ Size - 2 ] . "\n" , $ Out );
408408 $ Line = $ CIDRs [$ Size - 2 ];
409409 $ Size --;
410- if (!empty ($ this ->Results )) {
410+ if (!\ empty ($ this ->Results )) {
411411 $ this ->NumberMerged ++;
412412 $ this ->NumberReturned --;
413413 }
@@ -427,13 +427,13 @@ private function mergeRanges()
427427 */
428428 private function convertToNetmasks ()
429429 {
430- if (isset ($ this ->callbacks ['newParse ' ]) && \is_callable ($ this ->callbacks ['newParse ' ])) {
430+ if (\ isset ($ this ->callbacks ['newParse ' ]) && \is_callable ($ this ->callbacks ['newParse ' ])) {
431431 $ this ->callbacks ['newParse ' ](\substr_count ($ this ->Output , "\n" ));
432432 }
433433 $ this ->Output = $ Out = "\n" . $ this ->Output . "\n" ;
434434 $ Offset = 0 ;
435435 while (($ NewLine = \strpos ($ this ->Output , "\n" , $ Offset )) !== false ) {
436- if (isset ($ this ->callbacks ['newTick ' ]) && \is_callable ($ this ->callbacks ['newTick ' ])) {
436+ if (\ isset ($ this ->callbacks ['newTick ' ]) && \is_callable ($ this ->callbacks ['newTick ' ])) {
437437 $ this ->callbacks ['newTick ' ]();
438438 }
439439 $ Line = \substr ($ this ->Output , $ Offset , $ NewLine - $ Offset );
@@ -444,9 +444,9 @@ private function convertToNetmasks()
444444 $ Size = (int )\substr ($ Line , $ RangeSep + 1 );
445445 $ CIDR = \substr ($ Line , 0 , $ RangeSep );
446446 $ Type = ($ this ->expandIpv4 ($ CIDR , true )) ? 4 : 6 ;
447- if ($ Type === 4 && isset ($ this ->TableNetmaskIPv4 [$ Size ])) {
447+ if ($ Type === 4 && \ isset ($ this ->TableNetmaskIPv4 [$ Size ])) {
448448 $ Size = $ this ->TableNetmaskIPv4 [$ Size ];
449- } elseif ($ Type === 6 && isset ($ this ->TableNetmaskIPv6 [$ Size ])) {
449+ } elseif ($ Type === 6 && \ isset ($ this ->TableNetmaskIPv6 [$ Size ])) {
450450 $ Size = $ this ->TableNetmaskIPv6 [$ Size ];
451451 }
452452 $ Out = \str_replace ("\n" . $ Line . "\n" , "\n" . $ CIDR . '/ ' . $ Size . "\n" , $ Out );
0 commit comments