darsyn / ip

Immutable value object for IPv4 and IPv6 addresses, including helper methods and Doctrine support.
http://darsyn.github.io/ip/
MIT License
249 stars 21 forks source link

Greatest Common CIDR #81

Closed zanbaldwin closed 2 years ago

zanbaldwin commented 2 years ago

Add new getCommonCidr() helper method to IP interface, and implementations in AbstractIP and Multi, including unit tests and documentation.

use Darsyn\IP\Version\IPv4 as IP;

$one = IP::factory('192.168.247.2');
$two = IP::factory('192.168.199.43');

$one->getCommonCidr($two); // int(18)

Do not merge until after #75, #76, and #78 (expected conflicts).