Automattic\Phone\Mobile_Validator::validate_phone_iso3166 PHP Метод

validate_phone_iso3166() приватный Метод

private validate_phone_iso3166 ( $phone_number, $iso3166_entry )
    private function validate_phone_iso3166($phone_number, $iso3166_entry)
    {
        if (empty($iso3166_entry)) {
            return false;
        }
        $country_code = $iso3166_entry["country_code"];
        $unprefix_number = preg_replace("/^{$country_code}/", "", $phone_number);
        foreach ($iso3166_entry["phone_number_lengths"] as $number_length) {
            if (strlen($unprefix_number) == $number_length) {
                if (empty($iso3166_entry["mobile_begin_with"])) {
                    return true;
                }
                foreach ($iso3166_entry["mobile_begin_with"] as $mobile_prefix) {
                    if (0 === strpos($unprefix_number, $mobile_prefix)) {
                        return true;
                    }
                }
            }
        }
        return false;
    }