@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function setError(string $field, string $fieldRule, $errorMsg, $currentFieldValue): self |
| 87 | 87 | { |
| 88 | - $inputTag = $this->formDocument->find('[name=\'' . $field . '\']', 0); |
|
| 88 | + $inputTag = $this->formDocument->find('[name=\''.$field.'\']', 0); |
|
| 89 | 89 | if ($inputTag) { |
| 90 | 90 | /** @noinspection UnusedFunctionResultInspection */ |
| 91 | 91 | $inputTag->setAttribute('aria-invalid', 'true'); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | // overwrite the error message if needed |
| 95 | 95 | $fieldRule = (new ValidatorRulesManager)->getClassViaAlias($fieldRule)['class']; |
| 96 | - $errorMsgFromHtml = $inputTag->getAttribute('data-error-message--' . \strtolower($fieldRule)); |
|
| 96 | + $errorMsgFromHtml = $inputTag->getAttribute('data-error-message--'.\strtolower($fieldRule)); |
|
| 97 | 97 | if ($errorMsgFromHtml) { |
| 98 | 98 | $errorMsg = \sprintf($errorMsgFromHtml, \htmlspecialchars((string) $currentFieldValue, \ENT_COMPAT)); |
| 99 | 99 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function setValue(string $field, $value): self |
| 128 | 128 | { |
| 129 | - $inputTag = $this->formDocument->find('[name=\'' . $field . '\']', 0); |
|
| 129 | + $inputTag = $this->formDocument->find('[name=\''.$field.'\']', 0); |
|
| 130 | 130 | if ($inputTag) { |
| 131 | 131 | /** @noinspection UnusedFunctionResultInspection */ |
| 132 | 132 | $inputTag->setAttribute('aria-invalid', 'false'); |
@@ -146,14 +146,14 @@ discard block |
||
| 146 | 146 | public function writeErrorsIntoTheDom(): self |
| 147 | 147 | { |
| 148 | 148 | foreach ($this->errors as $field => $errors) { |
| 149 | - $inputTag = $this->formDocument->find('[name=\'' . $field . '\']', 0); |
|
| 149 | + $inputTag = $this->formDocument->find('[name=\''.$field.'\']', 0); |
|
| 150 | 150 | if ($inputTag) { |
| 151 | 151 | $errorMsgTemplateSelector = $inputTag->getAttribute('data-error-template-selector'); |
| 152 | 152 | if ($errorMsgTemplateSelector) { |
| 153 | 153 | $errorMsgTemplate = $this->formDocument->find($errorMsgTemplateSelector, 0); |
| 154 | 154 | if ($errorMsgTemplate) { |
| 155 | 155 | foreach ($errors as $error) { |
| 156 | - $errorMsgTemplate->innerText .= ' ' . $error; |
|
| 156 | + $errorMsgTemplate->innerText .= ' '.$error; |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $currentFieldData = \call_user_func_array([UTF8::class, $fieldFilter], $currentFieldData); |
| 156 | 156 | } else { |
| 157 | 157 | throw new UnknownFilter( |
| 158 | - 'No filter available for "' . $fieldFilter . '"' |
|
| 158 | + 'No filter available for "'.$fieldFilter.'"' |
|
| 159 | 159 | ); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $namespaceSeparator = '\\'; |
| 197 | 197 | $rulePrefix = \rtrim($phpNamespace, $namespaceSeparator); |
| 198 | 198 | |
| 199 | - return $rulePrefix . $namespaceSeparator; |
|
| 199 | + return $rulePrefix.$namespaceSeparator; |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
@@ -234,8 +234,8 @@ discard block |
||
| 234 | 234 | $fieldHelperChar = ''; |
| 235 | 235 | $fieldArrayTmp = \preg_replace_callback( |
| 236 | 236 | '/\[([^\]]+)\]/', |
| 237 | - function ($match) use ($fieldHelperChar) { |
|
| 238 | - return $match[1] . $fieldHelperChar; |
|
| 237 | + function($match) use ($fieldHelperChar) { |
|
| 238 | + return $match[1].$fieldHelperChar; |
|
| 239 | 239 | }, |
| 240 | 240 | $fieldArray |
| 241 | 241 | ); |
@@ -330,16 +330,16 @@ discard block |
||
| 330 | 330 | if ($htmlElement->id) { |
| 331 | 331 | $htmlElementHelperId = $htmlElement->id; |
| 332 | 332 | } elseif ($this->selector) { |
| 333 | - $htmlElementHelperId = 'html-element-validator-tmp-' . $this->selector; |
|
| 333 | + $htmlElementHelperId = 'html-element-validator-tmp-'.$this->selector; |
|
| 334 | 334 | } else { |
| 335 | 335 | $cssClassesTmp = \str_replace( |
| 336 | 336 | ' ', |
| 337 | 337 | '.', |
| 338 | 338 | $htmlElement->getAttribute('class') |
| 339 | 339 | ); |
| 340 | - $fakeCssSelector = $htmlElement->getNode()->getNodePath() . '/' . $cssClassesTmp; |
|
| 340 | + $fakeCssSelector = $htmlElement->getNode()->getNodePath().'/'.$cssClassesTmp; |
|
| 341 | 341 | |
| 342 | - $htmlElementHelperId = 'html-element-validator-tmp-' . $fakeCssSelector; |
|
| 342 | + $htmlElementHelperId = 'html-element-validator-tmp-'.$fakeCssSelector; |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | $htmlElementTagSelector = 'input, textarea, select'; |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | if ($inputType) { |
| 414 | 414 | $selectedRule = $this->autoSelectRuleByInputType($inputType); |
| 415 | 415 | if ($selectedRule) { |
| 416 | - $inputRule .= '|' . $selectedRule; |
|
| 416 | + $inputRule .= '|'.$selectedRule; |
|
| 417 | 417 | } |
| 418 | 418 | } |
| 419 | 419 | |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | |
| 424 | 424 | $inputPattern = $htmlElementField->getAttribute('pattern'); |
| 425 | 425 | if ($inputPattern) { |
| 426 | - $inputRule .= '|regex(/' . $inputPattern . '/)'; |
|
| 426 | + $inputRule .= '|regex(/'.$inputPattern.'/)'; |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | // |
@@ -432,22 +432,22 @@ discard block |
||
| 432 | 432 | |
| 433 | 433 | $inputMinLength = $htmlElementField->getAttribute('minlength'); |
| 434 | 434 | if ($inputMinLength) { |
| 435 | - $inputRule .= '|minLength(' . \serialize($inputMinLength) . ')'; |
|
| 435 | + $inputRule .= '|minLength('.\serialize($inputMinLength).')'; |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | $inputMaxLength = $htmlElementField->getAttribute('maxlength'); |
| 439 | 439 | if ($inputMaxLength) { |
| 440 | - $inputRule .= '|maxLength(' . \serialize($inputMaxLength) . ')'; |
|
| 440 | + $inputRule .= '|maxLength('.\serialize($inputMaxLength).')'; |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | $inputMin = $htmlElementField->getAttribute('min'); |
| 444 | 444 | if ($inputMin) { |
| 445 | - $inputRule .= '|min(' . \serialize($inputMin) . ')'; |
|
| 445 | + $inputRule .= '|min('.\serialize($inputMin).')'; |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | $inputMax = $htmlElementField->getAttribute('max'); |
| 449 | 449 | if ($inputMax) { |
| 450 | - $inputRule .= '|max(' . \serialize($inputMax) . ')'; |
|
| 450 | + $inputRule .= '|max('.\serialize($inputMax).')'; |
|
| 451 | 451 | } |
| 452 | 452 | } |
| 453 | 453 | |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | foreach ($htmlElementField->getElementsByTagName('option') as $option) { |
| 464 | 464 | $selectableValues[] = $option->getNode()->nodeValue; |
| 465 | 465 | } |
| 466 | - $inputRule .= '|in(' . \serialize($selectableValues) . ')'; |
|
| 466 | + $inputRule .= '|in('.\serialize($selectableValues).')'; |
|
| 467 | 467 | } elseif ( |
| 468 | 468 | ( |
| 469 | 469 | $inputType === 'checkbox' |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | ) { |
| 476 | 476 | $selectableValues = []; |
| 477 | 477 | |
| 478 | - $htmlElementFieldNames = $htmlElement->find('[name=\'' . $htmlElementField->name . '\']'); |
|
| 478 | + $htmlElementFieldNames = $htmlElement->find('[name=\''.$htmlElementField->name.'\']'); |
|
| 479 | 479 | |
| 480 | 480 | if ($htmlElementFieldNames) { |
| 481 | 481 | foreach ($htmlElementFieldNames as $htmlElementFieldName) { |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | } |
| 484 | 484 | } |
| 485 | 485 | |
| 486 | - $inputRule .= '|in(' . \serialize($selectableValues) . ')'; |
|
| 486 | + $inputRule .= '|in('.\serialize($selectableValues).')'; |
|
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | } |
| 647 | 647 | } catch (ComponentException $componentException) { |
| 648 | 648 | throw new UnknownValidationRule( |
| 649 | - 'No rule defined for: ' . $field . ' (rule: ' . $fieldRule . ' | class: ' . $validationClass . ')', |
|
| 649 | + 'No rule defined for: '.$field.' (rule: '.$fieldRule.' | class: '.$validationClass.')', |
|
| 650 | 650 | 500, |
| 651 | 651 | $componentException |
| 652 | 652 | ); |