| @@ -18,15 +18,11 @@ | ||
| 18 | 18 | use Nette\Forms; | 
| 19 | 19 | use Nette\Localization; | 
| 20 | 20 | use Nette\Utils; | 
| 21 | - | |
| 22 | 21 | use IPub; | 
| 23 | 22 | use IPub\FormPhone; | 
| 24 | 23 | use IPub\FormPhone\Exceptions; | 
| 25 | - | |
| 26 | 24 | use IPub\Phone\Phone as PhoneUtils; | 
| 27 | 25 | |
| 28 | -use libphonenumber; | |
| 29 | - | |
| 30 | 26 | /** | 
| 31 | 27 | * Form phone control element | 
| 32 | 28 | * | 
| @@ -295,10 +295,10 @@ discard block | ||
| 295 | 295 | */ | 
| 296 | 296 | public function loadHttpData() | 
| 297 | 297 |  	{ | 
| 298 | - $country = $this->getHttpData(Forms\Form::DATA_LINE, '[' . self::FIELD_COUNTRY . ']'); | |
| 298 | + $country = $this->getHttpData(Forms\Form::DATA_LINE, '['.self::FIELD_COUNTRY.']'); | |
| 299 | 299 | $this->country = ($country === '' || $country === NULL) ? NULL : (string) $country; | 
| 300 | 300 | |
| 301 | - $number = $this->getHttpData(Forms\Form::DATA_LINE, '[' . self::FIELD_NUMBER . ']'); | |
| 301 | + $number = $this->getHttpData(Forms\Form::DATA_LINE, '['.self::FIELD_NUMBER.']'); | |
| 302 | 302 | $this->number = ($number === '' || $number === NULL) ? NULL : (string) $number; | 
| 303 | 303 | } | 
| 304 | 304 | |
| @@ -308,7 +308,7 @@ discard block | ||
| 308 | 308 | public function getControl() | 
| 309 | 309 |  	{ | 
| 310 | 310 | $el = Utils\Html::el(); | 
| 311 | - $el->addHtml($this->getControlPart(self::FIELD_COUNTRY) . $this->getControlPart(self::FIELD_NUMBER)); | |
| 311 | + $el->addHtml($this->getControlPart(self::FIELD_COUNTRY).$this->getControlPart(self::FIELD_NUMBER)); | |
| 312 | 312 | |
| 313 | 313 | return $el; | 
| 314 | 314 | } | 
| @@ -347,7 +347,7 @@ discard block | ||
| 347 | 347 | ); | 
| 348 | 348 | |
| 349 | 349 |  				$result[$row] = Utils\Html::el('option'); | 
| 350 | -				$result[$row]->setText('+' . $this->phoneUtils->getCountryCodeForCountry($row) . ' (' . $countryName . ')'); | |
| 350 | +				$result[$row]->setText('+'.$this->phoneUtils->getCountryCodeForCountry($row).' ('.$countryName.')'); | |
| 351 | 351 |  				$result[$row]->data('mask', preg_replace('/[0-9]/', '9', $this->phoneUtils->getExampleNationalNumber($row))); | 
| 352 | 352 | $result[$row]->addAttributes([ | 
| 353 | 353 | 'value' => $row, | 
| @@ -364,12 +364,12 @@ discard block | ||
| 364 | 364 | ); | 
| 365 | 365 | |
| 366 | 366 | $control->addAttributes([ | 
| 367 | - 'name' => $name . '[' . self::FIELD_COUNTRY . ']', | |
| 368 | - 'id' => $this->getHtmlId() . '-' . self::FIELD_COUNTRY, | |
| 367 | + 'name' => $name.'['.self::FIELD_COUNTRY.']', | |
| 368 | + 'id' => $this->getHtmlId().'-'.self::FIELD_COUNTRY, | |
| 369 | 369 | ]); | 
| 370 | 370 |  			$control->data('ipub-forms-phone', ''); | 
| 371 | 371 |  			$control->data('settings', json_encode([ | 
| 372 | - 'field' => $name . '[' . self::FIELD_NUMBER . ']' | |
| 372 | + 'field' => $name.'['.self::FIELD_NUMBER.']' | |
| 373 | 373 | ]) | 
| 374 | 374 | ); | 
| 375 | 375 | |
| @@ -387,8 +387,8 @@ discard block | ||
| 387 | 387 |  			$control = Utils\Html::el('input'); | 
| 388 | 388 | |
| 389 | 389 | $control->addAttributes([ | 
| 390 | - 'name' => $name . '[' . self::FIELD_NUMBER . ']', | |
| 391 | - 'id' => $this->getHtmlId() . '-' . self::FIELD_NUMBER, | |
| 390 | + 'name' => $name.'['.self::FIELD_NUMBER.']', | |
| 391 | + 'id' => $this->getHtmlId().'-'.self::FIELD_NUMBER, | |
| 392 | 392 | 'value' => $this->number, | 
| 393 | 393 | 'type' => 'text', | 
| 394 | 394 | ]); | 
| @@ -448,7 +448,7 @@ discard block | ||
| 448 | 448 | // Phone type have to be upper-cased | 
| 449 | 449 | $type = strtoupper($type); | 
| 450 | 450 | |
| 451 | -		if (defined('\IPub\Phone\Phone::TYPE_' . $type)) { | |
| 451 | +		if (defined('\IPub\Phone\Phone::TYPE_'.$type)) { | |
| 452 | 452 | return $type; | 
| 453 | 453 | |
| 454 | 454 |  		} else { | 
| @@ -30,7 +30,7 @@ | ||
| 30 | 30 | */ | 
| 31 | 31 | public static function countryCodeToLocale(string $countryCode, string $languageCode = '') | 
| 32 | 32 |  	{ | 
| 33 | - $locale = 'en-' . $countryCode; | |
| 33 | + $locale = 'en-'.$countryCode; | |
| 34 | 34 | $localeRegion = locale_get_region($locale); | 
| 35 | 35 | $localeLanguage = locale_get_primary_language($locale); | 
| 36 | 36 | $localeArray = [ |