markrogoyski / ipv4-subnet-calculator-php

Network calculator for subnet mask and other classless (CIDR) network information.
MIT License
168 stars 42 forks source link

error method validateInputs #1

Closed sanchezzzhak closed 9 years ago

sanchezzzhak commented 9 years ago

replace

    /**
     * Validate IP address and network.
     * @param string $ip IP address in dotted quads format.
     * @param int $network_size Network.
     * @throws Exception ip or network size not valid
     */
    private function validateInputs( $ip, $network_size ) {
        if (!filter_var( $ip, FILTER_VALIDATE_IP )) {
            throw new Exception("IP address $ip not valid.");
        }
        if ( ( $network_size < 1 ) || ( $network_size > 32 ) ) {
            throw new Exception("Network size $network_size not valid.");
        }
    }
markrogoyski commented 9 years ago

Thanks. Updated.