src/SubnetReport.php
public function createPrintableReport(SubnetCalculator $sub)
    {
        $string  = sprintf("%-18s %15s %8s %32s\n", "{$sub->getIPAddress()}/{$sub->getNetworkSize()}", 'Quads', 'Hex', 'Binary');
        $string .= sprintf("%-18s %15s %8s %32s\n", '------------------', '---------------', '--------', '--------------------------------');
        $string .= sprintf("%-18s %15s %8s %32s\n", 'IP Address:', $sub->getIPAddress(), $sub->getIPAddressHex(), $sub->getIPAddressBinary());
        $string .= sprintf("%-18s %15s %8s %32s\n", 'Subnet Mask:', $sub->getSubnetMask(), $sub->getSubnetMaskHex(), $sub->getSubnetMaskBinary());
        $string .= sprintf("%-18s %15s %8s %32s\n", 'Network Portion:', $sub->getNetworkPortion(), $sub->getNetworkPortionHex(), $sub->getNetworkPortionBinary());
        $string .= sprintf("%-18s %15s %8s %32s\n", 'Host Portion:', $sub->getHostPortion(), $sub->getHostPortionHex(), $sub->getHostPortionBinary());
        $string .= \PHP_EOL;
        $string .= sprintf("%-28s %d\n", 'Number of IP Addresses:', $sub->getNumberIPAddresses());
        $string .= sprintf("%-28s %d\n", 'Number of Addressable Hosts:', $sub->getNumberAddressableHosts());
        $string .= sprintf("%-28s %s\n", 'IP Address Range:', implode(' - ', $sub->getIPAddressRange()));
        $string .= sprintf("%-28s %s\n", 'Broadcast Address:', $sub->getBroadcastAddress());
        $string .= sprintf("%-28s %s\n", 'Min Host:', $sub->getMinHost());
        $string .= sprintf("%-28s %s\n", 'Max Host:', $sub->getMaxHost());

        return $string;
    }
public function createPrintableReport(SubnetCalculator $sub)
    {
        $string  = sprintf("%-18s %15s %8s %32s\n", "{$sub->getIPAddress()}/{$sub->getNetworkSize()}", 'Quads', 'Hex', 'Binary');
        $string .= sprintf("%-18s %15s %8s %32s\n", '------------------', '---------------', '--------', '--------------------------------');
        $string .= sprintf("%-18s %15s %8s %32s\n", 'IP Address:', $sub->getIPAddress(), $sub->getIPAddressHex(), $sub->getIPAddressBinary());
        $string .= sprintf("%-18s %15s %8s %32s\n", 'Subnet Mask:', $sub->getSubnetMask(), $sub->getSubnetMaskHex(), $sub->getSubnetMaskBinary());
        $string .= sprintf("%-18s %15s %8s %32s\n", 'Network Portion:', $sub->getNetworkPortion(), $sub->getNetworkPortionHex(), $sub->getNetworkPortionBinary());
        $string .= sprintf("%-18s %15s %8s %32s\n", 'Host Portion:', $sub->getHostPortion(), $sub->getHostPortionHex(), $sub->getHostPortionBinary());
        $string .= \PHP_EOL;
        $string .= sprintf("%-28s %d\n", 'Number of IP Addresses:', $sub->getNumberIPAddresses());
        $string .= sprintf("%-28s %d\n", 'Number of Addressable Hosts:', $sub->getNumberAddressableHosts());
        $string .= sprintf("%-28s %s\n", 'IP Address Range:', implode(' - ', $sub->getIPAddressRange()));
        $string .= sprintf("%-28s %s\n", 'Broadcast Address:', $sub->getBroadcastAddress());
        $string .= sprintf("%-28s %s\n", 'Min Host:', $sub->getMinHost());
        $string .= sprintf("%-28s %s\n", 'Max Host:', $sub->getMaxHost());

        return $string;
    }
public function createPrintableReport ( SubnetCalculator $ sub ) { $ string = sprintf ( "%-18s %15s %8s %32s\n" , "{$sub->getIPAddress()}/{$sub->getNetworkSize()}" , 'Quads' , 'Hex' , 'Binary' ) ; $ string .= sprintf ( "%-18s %15s %8s %32s\n" , '------------------' , '---------------' , '--------' , '--------------------------------' ) ; $ string .= sprintf ( "%-18s %15s %8s %32s\n" , 'IP Address:' , $ sub -> getIPAddress ( ) , $ sub -> getIPAddressHex ( ) , $ sub -> getIPAddressBinary ( ) ) ; $ string .= sprintf ( "%-18s %15s %8s %32s\n" , 'Subnet Mask:' , $ sub -> getSubnetMask ( ) , $ sub -> getSubnetMaskHex ( ) , $ sub -> getSubnetMaskBinary ( ) ) ; $ string .= sprintf ( "%-18s %15s %8s %32s\n" , 'Network Portion:' , $ sub -> getNetworkPortion ( ) , $ sub -> getNetworkPortionHex ( ) , $ sub -> getNetworkPortionBinary ( ) ) ; $ string .= sprintf ( "%-18s %15s %8s %32s\n" , 'Host Portion:' , $ sub -> getHostPortion ( ) , $ sub -> getHostPortionHex ( ) , $ sub -> getHostPortionBinary ( ) ) ; $ string .= \ PHP_EOL ; $ string .= sprintf ( "%-28s %d\n" , 'Number of IP Addresses:' , $ sub -> getNumberIPAddresses ( ) ) ; $ string .= sprintf ( "%-28s %d\n" , 'Number of Addressable Hosts:' , $ sub -> getNumberAddressableHosts ( ) ) ; $ string .= sprintf ( "%-28s %s\n" , 'IP Address Range:' , implode ( ' - ' , $ sub -> getIPAddressRange ( ) ) ) ; $ string .= sprintf ( "%-28s %s\n" , 'Broadcast Address:' , $ sub -> getBroadcastAddress ( ) ) ; $ string .= sprintf ( "%-28s %s\n" , 'Min Host:' , $ sub -> getMinHost ( ) ) ; $ string .= sprintf ( "%-28s %s\n" , 'Max Host:' , $ sub -> getMaxHost ( ) ) ; return $ string ; }
Print a report of subnet calculations
Contains IP address, subnet mask, network portion and host portion.
Each of the above is provided in dotted quads, hexadecimal, and binary notation.
Also contains number of IP addresses and number of addressable hosts, IP address range, and broadcast address.

@param SubnetCalculator $sub

@return string report of subnet calculations
Print a report of subnet calculations Contains IP address subnet mask network portion and host portion . Each of the above is provided in dotted quads hexadecimal and binary notation . Also contains number of IP addresses and number of addressable hosts IP address range and broadcast address .