| 1 | # automatically generated file, don't edit | ||||||||||
| 2 | |||||||||||
| 3 | |||||||||||
| 4 | |||||||||||
| 5 | # Copyright 2026 David Cantrell, derived from data from libphonenumber | ||||||||||
| 6 | # http://code.google.com/p/libphonenumber/ | ||||||||||
| 7 | # | ||||||||||
| 8 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||
| 9 | # you may not use this file except in compliance with the License. | ||||||||||
| 10 | # You may obtain a copy of the License at | ||||||||||
| 11 | # | ||||||||||
| 12 | # http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||
| 13 | # | ||||||||||
| 14 | # Unless required by applicable law or agreed to in writing, software | ||||||||||
| 15 | # distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||
| 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||
| 17 | # See the License for the specific language governing permissions and | ||||||||||
| 18 | # limitations under the License. | ||||||||||
| 19 | package Number::Phone::StubCountry::BA; | ||||||||||
| 20 | 2 | ▶ | use base qw(Number::Phone::StubCountry); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | |||||||||||
| 22 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 2 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | 2 | our $VERSION = 1.20260904101547; | |||||||||
| 26 | |||||||||||
| 27 | 2 | my $formatters = [ | |||||||||
| 28 | { | ||||||||||
| 29 | 'format' => '$1-$2', | ||||||||||
| 30 | 'intl_format' => 'NA', | ||||||||||
| 31 | 'leading_digits' => '[2-9]', | ||||||||||
| 32 | 'pattern' => '(\\d{3})(\\d{3})' | ||||||||||
| 33 | }, | ||||||||||
| 34 | { | ||||||||||
| 35 | 'format' => '$1 $2 $3', | ||||||||||
| 36 | 'leading_digits' => ' | ||||||||||
| 37 | 6[1-3]| | ||||||||||
| 38 | [7-9] | ||||||||||
| 39 | ', | ||||||||||
| 40 | 'national_rule' => '0$1', | ||||||||||
| 41 | 'pattern' => '(\\d{2})(\\d{3})(\\d{3})' | ||||||||||
| 42 | }, | ||||||||||
| 43 | { | ||||||||||
| 44 | 'format' => '$1 $2-$3', | ||||||||||
| 45 | 'leading_digits' => ' | ||||||||||
| 46 | [3-5]| | ||||||||||
| 47 | 6[56] | ||||||||||
| 48 | ', | ||||||||||
| 49 | 'national_rule' => '0$1', | ||||||||||
| 50 | 'pattern' => '(\\d{2})(\\d{3})(\\d{3})' | ||||||||||
| 51 | }, | ||||||||||
| 52 | { | ||||||||||
| 53 | 'format' => '$1 $2 $3 $4', | ||||||||||
| 54 | 'leading_digits' => '6', | ||||||||||
| 55 | 'national_rule' => '0$1', | ||||||||||
| 56 | 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{3})' | ||||||||||
| 57 | } | ||||||||||
| 58 | ]; | ||||||||||
| 59 | |||||||||||
| 60 | 2 | my $validators = { | |||||||||
| 61 | 'fixed_line' => ' | ||||||||||
| 62 | (?: | ||||||||||
| 63 | 3(?: | ||||||||||
| 64 | [05-79][2-9]| | ||||||||||
| 65 | 1[4579]| | ||||||||||
| 66 | [23][24-9]| | ||||||||||
| 67 | 4[2-4689]| | ||||||||||
| 68 | 8[2457-9] | ||||||||||
| 69 | )| | ||||||||||
| 70 | 49[2-579]| | ||||||||||
| 71 | 5(?: | ||||||||||
| 72 | 0[2-49]| | ||||||||||
| 73 | [13][2-9]| | ||||||||||
| 74 | [268][2-4679]| | ||||||||||
| 75 | 4[4689]| | ||||||||||
| 76 | 5[2-79]| | ||||||||||
| 77 | 7[2-69]| | ||||||||||
| 78 | 9[2-4689] | ||||||||||
| 79 | ) | ||||||||||
| 80 | )\\d{5} | ||||||||||
| 81 | ', | ||||||||||
| 82 | 'geographic' => ' | ||||||||||
| 83 | (?: | ||||||||||
| 84 | 3(?: | ||||||||||
| 85 | [05-79][2-9]| | ||||||||||
| 86 | 1[4579]| | ||||||||||
| 87 | [23][24-9]| | ||||||||||
| 88 | 4[2-4689]| | ||||||||||
| 89 | 8[2457-9] | ||||||||||
| 90 | )| | ||||||||||
| 91 | 49[2-579]| | ||||||||||
| 92 | 5(?: | ||||||||||
| 93 | 0[2-49]| | ||||||||||
| 94 | [13][2-9]| | ||||||||||
| 95 | [268][2-4679]| | ||||||||||
| 96 | 4[4689]| | ||||||||||
| 97 | 5[2-79]| | ||||||||||
| 98 | 7[2-69]| | ||||||||||
| 99 | 9[2-4689] | ||||||||||
| 100 | ) | ||||||||||
| 101 | )\\d{5} | ||||||||||
| 102 | ', | ||||||||||
| 103 | 'mobile' => ' | ||||||||||
| 104 | 6040\\d{5}| | ||||||||||
| 105 | 6(?: | ||||||||||
| 106 | 03| | ||||||||||
| 107 | [1-356]| | ||||||||||
| 108 | 44| | ||||||||||
| 109 | 7\\d | ||||||||||
| 110 | )\\d{6} | ||||||||||
| 111 | ', | ||||||||||
| 112 | 'pager' => '', | ||||||||||
| 113 | 'personal_number' => '', | ||||||||||
| 114 | 'specialrate' => '(8[12]\\d{6})|(9[0246]\\d{6})|( | ||||||||||
| 115 | 703[235]0\\d{3}| | ||||||||||
| 116 | 70(?: | ||||||||||
| 117 | 2[0-5]| | ||||||||||
| 118 | 3[0146]| | ||||||||||
| 119 | [56]0 | ||||||||||
| 120 | )\\d{4} | ||||||||||
| 121 | )', | ||||||||||
| 122 | 'toll_free' => '8[08]\\d{6}', | ||||||||||
| 123 | 'voip' => '' | ||||||||||
| 124 | }; | ||||||||||
| 125 | 2 | my %areanames = (); | |||||||||
| 126 | 2 | $areanames{sr} = {"38755", "Бијељина", | |||||||||
| 127 | "38738", "Босанско\-подрињски\ кантон\ Горажде", | ||||||||||
| 128 | "38751", "Бања\ Лука", | ||||||||||
| 129 | "38733", "Сарајевски\ кантон", | ||||||||||
| 130 | "38730", "Средњoбосански\ кантон", | ||||||||||
| 131 | "38732", "Зеничко\-добојски\ кантон", | ||||||||||
| 132 | "38734", "Кантон\ 10", | ||||||||||
| 133 | "38756", "Зворник", | ||||||||||
| 134 | "38757", "Источно\ Сарајево", | ||||||||||
| 135 | "3874", "Брчко\ Дистрикт", | ||||||||||
| 136 | "38752", "Приједор", | ||||||||||
| 137 | "38753", "Добој", | ||||||||||
| 138 | "38750", "Мркоњић\ Град", | ||||||||||
| 139 | "38731", "Посавски\ кантон", | ||||||||||
| 140 | "38758", "Фоча", | ||||||||||
| 141 | "38735", "Тузлански\ кантон", | ||||||||||
| 142 | "38737", "Унско\-сански\ кантон", | ||||||||||
| 143 | "38754", "Шамац", | ||||||||||
| 144 | "38759", "Требиње",}; | ||||||||||
| 145 | 2 | $areanames{hr} = {"38734", "Hercegbosanska\ županija", | |||||||||
| 146 | "38739", "Županija\ Zapadnohercegovačka", | ||||||||||
| 147 | "38732", "Zeničko\-dobojska\ županija", | ||||||||||
| 148 | "38730", "Županija\ Središnja\ Bosna", | ||||||||||
| 149 | "38733", "Sarajevska\ županija", | ||||||||||
| 150 | "38738", "Bosansko\-podrinjska\ županija\ Goražde", | ||||||||||
| 151 | "38736", "Hercegovačko\-neretvanska\ županija", | ||||||||||
| 152 | "38737", "Unsko\-sanska\ županija", | ||||||||||
| 153 | "38735", "Tuzlanska\ županija", | ||||||||||
| 154 | "38731", "Županija\ Posavska",}; | ||||||||||
| 155 | 2 | $areanames{en} = {"38756", "Zvornik", | |||||||||
| 156 | "38757", "East\ Sarajevo", | ||||||||||
| 157 | "38739", "West\ Herzegovina\ Canton", | ||||||||||
| 158 | "38734", "Canton\ 10", | ||||||||||
| 159 | "38732", "Zenica\-Doboj\ Canton", | ||||||||||
| 160 | "38755", "Bijeljina", | ||||||||||
| 161 | "38730", "Central\ Bosnia\ Canton", | ||||||||||
| 162 | "38733", "Sarajevo\ Canton", | ||||||||||
| 163 | "38738", "Bosnian\-Podrinje\ Canton\ Goražde", | ||||||||||
| 164 | "38751", "Banja\ Luka", | ||||||||||
| 165 | "38754", "Šamac", | ||||||||||
| 166 | "38759", "Trebinje", | ||||||||||
| 167 | "38737", "Una\-Sana\ Canton", | ||||||||||
| 168 | "38736", "Herzegovina\-Neretva\ Canton", | ||||||||||
| 169 | "38758", "Foča", | ||||||||||
| 170 | "38731", "Posavina\ Canton", | ||||||||||
| 171 | "38753", "Doboj", | ||||||||||
| 172 | "38750", "Mrkonjić\ Grad", | ||||||||||
| 173 | "38735", "Tuzla\ Canton", | ||||||||||
| 174 | "3874", "Brčko\ District", | ||||||||||
| 175 | "38752", "Prijedor",}; | ||||||||||
| 176 | 2 | $areanames{bs} = {"38732", "Zeničko\-dobojski\ kanton", | |||||||||
| 177 | "38730", "Srednjobosanski\ kanton", | ||||||||||
| 178 | "38733", "Kanton\ Sarajevo", | ||||||||||
| 179 | "38738", "Bosansko\-podrinjski\ kanton\ Goražde", | ||||||||||
| 180 | "38757", "Istočno\ Sarajevo", | ||||||||||
| 181 | "38734", "kanton\ 10", | ||||||||||
| 182 | "38739", "Zapadnohercegovački\ kanton", | ||||||||||
| 183 | "38735", "Tuzlanski\ kanton", | ||||||||||
| 184 | "38731", "Posavski\ kanton", | ||||||||||
| 185 | "3874", "Brčko\ Distrikt", | ||||||||||
| 186 | "38736", "Hercegovačko\-neretvanski\ kanton", | ||||||||||
| 187 | "38737", "Unsko\-sanski\ kanton",}; | ||||||||||
| 188 | 2 | my $timezones = { | |||||||||
| 189 | '' => [ | ||||||||||
| 190 | 'Europe/Sarajevo' | ||||||||||
| 191 | ] | ||||||||||
| 192 | }; | ||||||||||
| 193 | |||||||||||
| 194 | 19 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 195 | 19 | my $class = shift; | |||||||||
| 196 | 19 | my $number = shift; | |||||||||
| 197 | 19 | $number =~ s/(^\+387|\D)//g; | |||||||||
| 198 | 19 | my $self = bless({ country_code => '387', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, areanames => \%areanames}, $class); | |||||||||
| 199 | 19 | ▶ | return $self if ($self->is_valid()); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 200 | 1 | $number =~ s/^(?:0)//; | |||||||||
| 201 | 1 | $self = bless({ country_code => '387', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); | |||||||||
| 202 | 1 | ▶ | return $self->is_valid() ? $self : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 203 | } | ||||||||||
| 204 | 2 | 1; | |||||||||