Completed
Pull Request — master (#6)
by
unknown
02:29
created
src/IPub/FormPhone/Controls/Phone.php 2 patches
Unused Use Statements   -4 removed lines patch added patch discarded remove patch
@@ -18,15 +18,11 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @date           15.12.15
13 13
  */
14 14
 
15
-declare(strict_types = 1);
15
+declare(strict_types=1);
16 16
 
17 17
 namespace IPub\FormPhone\Controls;
18 18
 
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'),
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 	public function getLabel($caption = NULL)
446 446
 	{
447 447
 		$label = parent::getLabel($caption);
448
-		$label->for = $this->getHtmlId() . '-' . self::FIELD_NUMBER;
448
+		$label->for = $this->getHtmlId().'-'.self::FIELD_NUMBER;
449 449
 
450 450
 		return $label;
451 451
 	}
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 		// Phone type have to be upper-cased
491 491
 		$type = strtoupper($type);
492 492
 
493
-		if (defined('\IPub\Phone\Phone::TYPE_' . $type)) {
493
+		if (defined('\IPub\Phone\Phone::TYPE_'.$type)) {
494 494
 			return $type;
495 495
 
496 496
 		} else {
Please login to merge, or discard this patch.
src/IPub/FormPhone/Forms/PhoneValidator.php 2 patches
Unused Use Statements   -5 removed lines patch added patch discarded remove patch
@@ -16,18 +16,13 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
  * @date           12.12.15
13 13
  */
14 14
 
15
-declare(strict_types = 1);
15
+declare(strict_types=1);
16 16
 
17 17
 namespace IPub\FormPhone\Forms;
18 18
 
Please login to merge, or discard this patch.
src/IPub/FormPhone/DI/FormPhoneExtension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
  * @date           15.12.15
13 13
  */
14 14
 
15
-declare(strict_types = 1);
15
+declare(strict_types=1);
16 16
 
17 17
 namespace IPub\FormPhone\DI;
18 18
 
Please login to merge, or discard this patch.
src/IPub/FormPhone/Locale/Locale.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @date           20.08.16
13 13
  */
14 14
 
15
-declare(strict_types = 1);
15
+declare(strict_types=1);
16 16
 
17 17
 namespace IPub\FormPhone\Locale;
18 18
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
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 = [
Please login to merge, or discard this patch.
src/IPub/FormPhone/Exceptions/IException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
  * @date           17.12.15
13 13
  */
14 14
 
15
-declare(strict_types = 1);
15
+declare(strict_types=1);
16 16
 
17 17
 namespace IPub\FormPhone\Exceptions;
18 18
 
Please login to merge, or discard this patch.
src/IPub/FormPhone/Exceptions/NoValidTypeException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
  * @date           19.12.15
13 13
  */
14 14
 
15
-declare(strict_types = 1);
15
+declare(strict_types=1);
16 16
 
17 17
 namespace IPub\FormPhone\Exceptions;
18 18
 
Please login to merge, or discard this patch.
src/IPub/FormPhone/Exceptions/NoValidCountryException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
  * @date           17.12.15
13 13
  */
14 14
 
15
-declare(strict_types = 1);
15
+declare(strict_types=1);
16 16
 
17 17
 namespace IPub\FormPhone\Exceptions;
18 18
 
Please login to merge, or discard this patch.
src/IPub/FormPhone/Exceptions/InvalidArgumentException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
  * @date           17.12.15
13 13
  */
14 14
 
15
-declare(strict_types = 1);
15
+declare(strict_types=1);
16 16
 
17 17
 namespace IPub\FormPhone\Exceptions;
18 18
 
Please login to merge, or discard this patch.