@@ -20,15 +20,11 @@ |
||
20 | 20 | use Nette\Forms; |
21 | 21 | use Nette\Localization; |
22 | 22 | use Nette\Utils; |
23 | - |
|
24 | 23 | use IPub; |
25 | 24 | use IPub\FormPhone; |
26 | 25 | use IPub\FormPhone\Exceptions; |
27 | - |
|
28 | 26 | use IPub\Phone\Phone as PhoneUtils; |
29 | 27 | |
30 | -use libphonenumber; |
|
31 | - |
|
32 | 28 | /** |
33 | 29 | * Form phone control element |
34 | 30 | * |
@@ -321,10 +321,10 @@ discard block |
||
321 | 321 | */ |
322 | 322 | public function loadHttpData() |
323 | 323 | { |
324 | - $country = $this->getHttpData(Forms\Form::DATA_LINE, '[' . self::FIELD_COUNTRY . ']'); |
|
324 | + $country = $this->getHttpData(Forms\Form::DATA_LINE, '['.self::FIELD_COUNTRY.']'); |
|
325 | 325 | $this->country = ($country === '' || $country === NULL) ? NULL : (string) $country; |
326 | 326 | |
327 | - $number = $this->getHttpData(Forms\Form::DATA_LINE, '[' . self::FIELD_NUMBER . ']'); |
|
327 | + $number = $this->getHttpData(Forms\Form::DATA_LINE, '['.self::FIELD_NUMBER.']'); |
|
328 | 328 | $this->number = ($number === '' || $number === NULL) ? NULL : (string) $number; |
329 | 329 | } |
330 | 330 | |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | public function getControl() |
335 | 335 | { |
336 | 336 | $el = Utils\Html::el(); |
337 | - $el->addHtml($this->getControlPart(self::FIELD_COUNTRY) . $this->getControlPart(self::FIELD_NUMBER)); |
|
337 | + $el->addHtml($this->getControlPart(self::FIELD_COUNTRY).$this->getControlPart(self::FIELD_NUMBER)); |
|
338 | 338 | |
339 | 339 | return $el; |
340 | 340 | } |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | ); |
374 | 374 | |
375 | 375 | $result[$row] = Utils\Html::el('option'); |
376 | - $result[$row]->setText('+' . $this->phoneUtils->getCountryCodeForCountry($row) . ' (' . $countryName . ')'); |
|
376 | + $result[$row]->setText('+'.$this->phoneUtils->getCountryCodeForCountry($row).' ('.$countryName.')'); |
|
377 | 377 | $result[$row]->data('mask', preg_replace('/[0-9]/', '9', $this->phoneUtils->getExampleNationalNumber($row))); |
378 | 378 | $result[$row]->addAttributes([ |
379 | 379 | 'value' => $row, |
@@ -390,12 +390,12 @@ discard block |
||
390 | 390 | ); |
391 | 391 | |
392 | 392 | $control->addAttributes([ |
393 | - 'name' => $name . '[' . self::FIELD_COUNTRY . ']', |
|
394 | - 'id' => $this->getHtmlId() . '-' . self::FIELD_COUNTRY, |
|
393 | + 'name' => $name.'['.self::FIELD_COUNTRY.']', |
|
394 | + 'id' => $this->getHtmlId().'-'.self::FIELD_COUNTRY, |
|
395 | 395 | ]); |
396 | 396 | $control->data('ipub-forms-phone', ''); |
397 | 397 | $control->data('settings', json_encode([ |
398 | - 'field' => $name . '[' . self::FIELD_NUMBER . ']' |
|
398 | + 'field' => $name.'['.self::FIELD_NUMBER.']' |
|
399 | 399 | ]) |
400 | 400 | ); |
401 | 401 | |
@@ -415,8 +415,8 @@ discard block |
||
415 | 415 | $control = Utils\Html::el('input'); |
416 | 416 | |
417 | 417 | $control->addAttributes([ |
418 | - 'name' => $name . '[' . self::FIELD_NUMBER . ']', |
|
419 | - 'id' => $this->getHtmlId() . '-' . self::FIELD_NUMBER, |
|
418 | + 'name' => $name.'['.self::FIELD_NUMBER.']', |
|
419 | + 'id' => $this->getHtmlId().'-'.self::FIELD_NUMBER, |
|
420 | 420 | 'value' => $this->number, |
421 | 421 | 'type' => 'text', |
422 | 422 | 'class' => $prototype->getAttribute('class'), |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | public function getLabel($caption = NULL) |
444 | 444 | { |
445 | 445 | $label = parent::getLabel($caption); |
446 | - $label->for = $this->getHtmlId() . '-' . self::FIELD_NUMBER; |
|
446 | + $label->for = $this->getHtmlId().'-'.self::FIELD_NUMBER; |
|
447 | 447 | |
448 | 448 | return $label; |
449 | 449 | } |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | // Phone type have to be upper-cased |
489 | 489 | $type = strtoupper($type); |
490 | 490 | |
491 | - if (defined('\IPub\Phone\Phone::TYPE_' . $type)) { |
|
491 | + if (defined('\IPub\Phone\Phone::TYPE_'.$type)) { |
|
492 | 492 | return $type; |
493 | 493 | |
494 | 494 | } else { |
@@ -16,18 +16,13 @@ |
||
16 | 16 | |
17 | 17 | namespace IPub\FormPhone\Forms; |
18 | 18 | |
19 | -use Nette; |
|
20 | 19 | use Nette\Forms; |
21 | - |
|
22 | 20 | use libphonenumber; |
23 | 21 | use libphonenumber\PhoneNumberUtil; |
24 | - |
|
25 | 22 | use IPub\FormPhone; |
26 | 23 | use IPub\FormPhone\Controls; |
27 | 24 | use IPub\FormPhone\Exceptions; |
28 | - |
|
29 | 25 | use IPub\Phone; |
30 | -use Tracy\Debugger; |
|
31 | 26 | |
32 | 27 | /** |
33 | 28 | * Phone number control form field validator |
@@ -38,7 +38,7 @@ |
||
38 | 38 | */ |
39 | 39 | public static function countryCodeToLocale(string $countryCode, string $languageCode = '') |
40 | 40 | { |
41 | - $locale = 'en-' . $countryCode; |
|
41 | + $locale = 'en-'.$countryCode; |
|
42 | 42 | $localeRegion = locale_get_region($locale); |
43 | 43 | $localeLanguage = locale_get_primary_language($locale); |
44 | 44 | $localeArray = [ |