Completed
Push — master ( 3141b5...4fe81d )
by Adam
09:31
created
src/IPub/FormPhone/Controls/Phone.php 2 patches
Unused Use Statements   -5 removed lines patch added patch discarded remove patch
@@ -20,16 +20,11 @@
 block discarded – undo
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
-use Tracy\Debugger;
32
-
33 28
 /**
34 29
  * Form phone control element
35 30
  *
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 {
Please login to merge, or discard this patch.
src/IPub/FormPhone/Forms/PhoneValidator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
 	public static function validatePhone(Forms\IControl $control, array $params = []) : bool
61 61
 	{
62 62
 		if (!$control instanceof Controls\Phone) {
63
-			throw new Exceptions\InvalidArgumentException('This validator could be used only on phone field. You used it on: "' . get_class($control) . '"');
63
+			throw new Exceptions\InvalidArgumentException('This validator could be used only on phone field. You used it on: "'.get_class($control).'"');
64 64
 		}
65 65
 
66 66
 		// Get form element value
Please login to merge, or discard this patch.
src/IPub/FormPhone/Locale/Locale.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
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 = [
Please login to merge, or discard this patch.