PHP Classes

File: src/Aggregator.php

Recommend this page to a friend!
  Classes of Caleb   Aggregator   src/Aggregator.php  
File: src/Aggregator.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Aggregator
Aggregate multiple IP addresses in single ranges
Author: By
Last change: v1.3.5
Fix comments.
Returning aggregate output as an array (#11).

Changelog excerpt:
- Refactored and added the ability to return aggregated data as an array.
Stricter typing.
Performance improvement.
Bug-fix (CIDRAM/CIDRAM#486).

Changelog excerpt:
- The aggregator's constructTables method was constructing the wrong IPv6
netmask for last hextet; Fixed.
Bug-fix.

Changelog excerpt:
- Should add to, rather than replace, the numbers counted by the
aggregator, and use only resetNumbers to reset those numbers explicitly,
due to the risk of wrong final values being presented for split/tagged
operations; Fixed.
Backwards-compatibility patch.
Split expand methods to their own trait.

Changelog excerpt:
- Split the methods for expanding CIDRs out to their own trait.
Improve file headers.
Code-style cleanup.

- Public before private properties.
- Magic before public before private methods.
Fix wrong phpdoc comment.

Thanks to @0x11DFE for spotting this. :-)
Bug-fix.

Changelog excerpt:
- Aggregating a single IP address with its own CIDR equivalent (i.e., a
range containing just one IP address) produced output with a wider than
expected range; Fixed.
Code-style patch.
Code-style patch.
Add missing PHPDoc comment.
v1.3.2
Small code-style and typo fix.
v1.3.1

Slightly improved some PHPDoc annotations.
QA (#7).

Some minor optimisations plus removal of some unused variable
declarations (thank you to @guytomer for spotting these).
QA (#7).

Added some code to enable shortcutting part of the process for removing
subordinates from the aggregate where possible to do so. This may
occasionally speed up the overall process significantly.
QA (#7).

Fix malformed number notice and refactor.
QA (#7).

Improves benchmarks/performance by roughly ~6% by skipping a few
unnecessary calculations during stripInvalidRangesAndSubs. Though, further
work is still needed to improve benchmarks/performance in this area.
See: #9

Changelog excerpt:

- Removed public member Input (wasn't used anywhere in the code and was
basically pointless). Added the ability to pass an array to the aggregate
method (whether the passed parameter is a string or an array is now
checked by stripInvalidCharactersAndSort, instead of it being assumed).
Bug-fix (#8).

Changelog excerpt:

- Due to some lines mistakenly removed in an earlier commit (2019.12.12),
NumberEntered was failing to populate, therefore causing erroneous result
values to be reported when aggregating; Fixed. Thanks to nistorj for
reporting this bug.
Bug-fix.

- Syntactically invalid IPv6 addresses could be potentially accepted or
produced by the aggregator in some obscure circumstances due an
insufficiently bound regular expression; Fixed.
Adjust spacing.
Bug-fix.

Changelog excerpt:

- The IP aggregator was able to successfully capture IPs and CIDRs
contained within comments, but it should be ignoring comments
entirely; Fixed.
Remove superfluous code.
Fix typo.

Whoops.. Not sure how that one snuck in. My bad.
Adds callable hooks to assist with benchmarking.

Changelog excerpt:

- Added some callable hooks to the IP aggregator to assist with
benchmarking and progress reporting in some contexts (e.g., CLI).
Date: 2 days ago
Size: 16,877 bytes

You need to be a registered user and login to get this file.

Login Immediately with your account on: