@@ -85,13 +85,13 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function setError(string $field, string $fieldRule, $errorMsg, $currentFieldValue): self |
| 87 | 87 | { |
| 88 | - $inputTag = $this->formDocument->findOneOrFalse('[name=\'' . $field . '\']'); |
|
| 88 | + $inputTag = $this->formDocument->findOneOrFalse('[name=\''.$field.'\']'); |
|
| 89 | 89 | if ($inputTag) { |
| 90 | 90 | $inputTag->setAttribute('aria-invalid', 'true'); |
| 91 | 91 | |
| 92 | 92 | // overwrite the error message if needed |
| 93 | 93 | $fieldRule = (new ValidatorRulesManager())->getClassViaAlias($fieldRule)['class']; |
| 94 | - $errorMsgFromHtml = $inputTag->getAttribute('data-error-message--' . \strtolower($fieldRule)); |
|
| 94 | + $errorMsgFromHtml = $inputTag->getAttribute('data-error-message--'.\strtolower($fieldRule)); |
|
| 95 | 95 | if ($errorMsgFromHtml) { |
| 96 | 96 | $errorMsg = \sprintf($errorMsgFromHtml, \htmlspecialchars((string) $currentFieldValue, \ENT_COMPAT)); |
| 97 | 97 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function setValue(string $field, $value): self |
| 127 | 127 | { |
| 128 | - $inputTag = $this->formDocument->findOneOrFalse('[name=\'' . $field . '\']'); |
|
| 128 | + $inputTag = $this->formDocument->findOneOrFalse('[name=\''.$field.'\']'); |
|
| 129 | 129 | if ($inputTag) { |
| 130 | 130 | $inputTag->setAttribute('aria-invalid', 'false'); |
| 131 | 131 | |
@@ -144,14 +144,14 @@ discard block |
||
| 144 | 144 | public function writeErrorsIntoTheDom(): self |
| 145 | 145 | { |
| 146 | 146 | foreach ($this->errors as $field => $errors) { |
| 147 | - $inputTag = $this->formDocument->findOneOrFalse('[name=\'' . $field . '\']'); |
|
| 147 | + $inputTag = $this->formDocument->findOneOrFalse('[name=\''.$field.'\']'); |
|
| 148 | 148 | if ($inputTag) { |
| 149 | 149 | $errorMsgTemplateSelector = $inputTag->getAttribute('data-error-template-selector'); |
| 150 | 150 | if ($errorMsgTemplateSelector) { |
| 151 | 151 | $errorMsgTemplate = $this->formDocument->findOneOrFalse($errorMsgTemplateSelector); |
| 152 | 152 | if ($errorMsgTemplate) { |
| 153 | 153 | foreach ($errors as $error) { |
| 154 | - $errorMsgTemplate->innertext .= ' ' . $error; |
|
| 154 | + $errorMsgTemplate->innertext .= ' '.$error; |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $currentFieldData = \call_user_func_array([UTF8::class, $fieldFilter], $currentFieldData); |
| 161 | 161 | } else { |
| 162 | 162 | throw new UnknownFilter( |
| 163 | - 'No filter available for "' . $fieldFilter . '"' |
|
| 163 | + 'No filter available for "'.$fieldFilter.'"' |
|
| 164 | 164 | ); |
| 165 | 165 | } |
| 166 | 166 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $namespaceSeparator = '\\'; |
| 202 | 202 | $rulePrefix = \rtrim($phpNamespace, $namespaceSeparator); |
| 203 | 203 | |
| 204 | - return $rulePrefix . $namespaceSeparator; |
|
| 204 | + return $rulePrefix.$namespaceSeparator; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -240,8 +240,8 @@ discard block |
||
| 240 | 240 | $fieldHelperChar = ''; |
| 241 | 241 | $fieldArrayTmp = \preg_replace_callback( |
| 242 | 242 | '/\[([^]]+)]/', |
| 243 | - static function ($match) use ($fieldHelperChar) { |
|
| 244 | - return $match[1] . $fieldHelperChar; |
|
| 243 | + static function($match) use ($fieldHelperChar) { |
|
| 244 | + return $match[1].$fieldHelperChar; |
|
| 245 | 245 | }, |
| 246 | 246 | $fieldArray |
| 247 | 247 | ); |
@@ -335,16 +335,16 @@ discard block |
||
| 335 | 335 | if ($htmlElement->id) { |
| 336 | 336 | $htmlElementHelperId = $htmlElement->id; |
| 337 | 337 | } elseif ($this->selector) { |
| 338 | - $htmlElementHelperId = 'html-element-validator-tmp-' . $this->selector; |
|
| 338 | + $htmlElementHelperId = 'html-element-validator-tmp-'.$this->selector; |
|
| 339 | 339 | } else { |
| 340 | 340 | $cssClassesTmp = \str_replace( |
| 341 | 341 | ' ', |
| 342 | 342 | '.', |
| 343 | 343 | $htmlElement->getAttribute('class') |
| 344 | 344 | ); |
| 345 | - $fakeCssSelector = $htmlElement->getNode()->getNodePath() . '/' . $cssClassesTmp; |
|
| 345 | + $fakeCssSelector = $htmlElement->getNode()->getNodePath().'/'.$cssClassesTmp; |
|
| 346 | 346 | |
| 347 | - $htmlElementHelperId = 'html-element-validator-tmp-' . $fakeCssSelector; |
|
| 347 | + $htmlElementHelperId = 'html-element-validator-tmp-'.$fakeCssSelector; |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | $htmlElementTagSelector = 'input, textarea, select'; |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | if ($inputType) { |
| 428 | 428 | $selectedRule = $this->autoSelectRuleByInputType($inputType); |
| 429 | 429 | if ($selectedRule) { |
| 430 | - $inputRule .= '|' . $selectedRule; |
|
| 430 | + $inputRule .= '|'.$selectedRule; |
|
| 431 | 431 | } |
| 432 | 432 | } |
| 433 | 433 | |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | |
| 438 | 438 | $inputPattern = $htmlElementField->getAttribute('pattern'); |
| 439 | 439 | if ($inputPattern) { |
| 440 | - $inputRule .= '|regex(/' . $inputPattern . '/)'; |
|
| 440 | + $inputRule .= '|regex(/'.$inputPattern.'/)'; |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | // |
@@ -446,22 +446,22 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | $inputMinLength = $htmlElementField->getAttribute('minlength'); |
| 448 | 448 | if ($inputMinLength) { |
| 449 | - $inputRule .= '|minLength(' . \serialize($inputMinLength) . ')'; |
|
| 449 | + $inputRule .= '|minLength('.\serialize($inputMinLength).')'; |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | $inputMaxLength = $htmlElementField->getAttribute('maxlength'); |
| 453 | 453 | if ($inputMaxLength) { |
| 454 | - $inputRule .= '|maxLength(' . \serialize($inputMaxLength) . ')'; |
|
| 454 | + $inputRule .= '|maxLength('.\serialize($inputMaxLength).')'; |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | $inputMin = $htmlElementField->getAttribute('min'); |
| 458 | 458 | if ($inputMin) { |
| 459 | - $inputRule .= '|min(' . \serialize($inputMin) . ')'; |
|
| 459 | + $inputRule .= '|min('.\serialize($inputMin).')'; |
|
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | $inputMax = $htmlElementField->getAttribute('max'); |
| 463 | 463 | if ($inputMax) { |
| 464 | - $inputRule .= '|max(' . \serialize($inputMax) . ')'; |
|
| 464 | + $inputRule .= '|max('.\serialize($inputMax).')'; |
|
| 465 | 465 | } |
| 466 | 466 | } |
| 467 | 467 | |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | foreach ($htmlElementField->getElementsByTagName('option') as $option) { |
| 481 | 481 | $selectableValues[] = $option->getNode()->nodeValue; |
| 482 | 482 | } |
| 483 | - $inputRule .= '|in(' . \serialize($selectableValues) . ')'; |
|
| 483 | + $inputRule .= '|in('.\serialize($selectableValues).')'; |
|
| 484 | 484 | } elseif ( |
| 485 | 485 | ( |
| 486 | 486 | $inputType === 'checkbox' |
@@ -492,14 +492,14 @@ discard block |
||
| 492 | 492 | ) { |
| 493 | 493 | $selectableValues = []; |
| 494 | 494 | |
| 495 | - $htmlElementFieldNames = $htmlElement->findMultiOrFalse('[name=\'' . $htmlElementField->getAttribute('name') . '\']'); |
|
| 495 | + $htmlElementFieldNames = $htmlElement->findMultiOrFalse('[name=\''.$htmlElementField->getAttribute('name').'\']'); |
|
| 496 | 496 | if ($htmlElementFieldNames) { |
| 497 | 497 | foreach ($htmlElementFieldNames as $htmlElementFieldName) { |
| 498 | 498 | $selectableValues[] = $htmlElementFieldName->getAttribute('value'); |
| 499 | 499 | } |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - $inputRule .= '|in(' . \serialize($selectableValues) . ')'; |
|
| 502 | + $inputRule .= '|in('.\serialize($selectableValues).')'; |
|
| 503 | 503 | } |
| 504 | 504 | } |
| 505 | 505 | |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | } |
| 671 | 671 | } catch (ComponentException $componentException) { |
| 672 | 672 | throw new UnknownValidationRule( |
| 673 | - 'No rule defined for: ' . $field . ' (rule: ' . $fieldRule . ' | class: ' . $validationClass . ')', |
|
| 673 | + 'No rule defined for: '.$field.' (rule: '.$fieldRule.' | class: '.$validationClass.')', |
|
| 674 | 674 | 500, |
| 675 | 675 | $componentException |
| 676 | 676 | ); |