src/IPAddress.php
private static function myValidateOctets(array $octets, ?string &$error): bool
    {
        if (count($octets) !== 4) {
            $error = 'IP address must consist of four octets.';

            return false;
        }

        foreach ($octets as $octet) {
            if (!is_int($octet)) {
                throw new \InvalidArgumentException('$octets is not an array of integers.');
            }

            if (!self::myValidateOctet($octet, $error)) {
                return false;
            }
        }

        return true;
    }
private static function myValidateOctets(array $octets, ?string &$error): bool
    {
        if (count($octets) !== 4) {
            $error = 'IP address must consist of four octets.';

            return false;
        }

        foreach ($octets as $octet) {
            if (!is_int($octet)) {
                throw new \InvalidArgumentException('$octets is not an array of integers.');
            }

            if (!self::myValidateOctet($octet, $error)) {
                return false;
            }
        }

        return true;
    }
private static function myValidateOctets ( array $ octets , ? string & $ error ) : bool { if ( count ( $ octets ) !== 4 ) { $ error = 'IP address must consist of four octets.' ; return false ; } foreach ( $ octets as $ octet ) { if ( ! is_int ( $ octet ) ) { throw new \ InvalidArgumentException ( '$octets is not an array of integers.' ) ; } if ( ! self :: myValidateOctet ( $ octet , $ error ) ) { return false ; } } return true ; }
Validates an array of octets.

@param int[]       $octets The array of octets.
@param string|null $error  The error text if validation was not successful, undefined otherwise.

@throws \InvalidArgumentException If the octets parameter is not an array of integers.

@return bool True if validation was successful, false otherwise.
Validates an array of octets .