@@ -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 | } |
@@ -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 | /** |
@@ -235,8 +235,8 @@ discard block |
||
| 235 | 235 | $fieldHelperChar = ''; |
| 236 | 236 | $fieldArrayTmp = \preg_replace_callback( |
| 237 | 237 | '/\[([^]]+)]/', |
| 238 | - static function ($match) use ($fieldHelperChar) { |
|
| 239 | - return $match[1] . $fieldHelperChar; |
|
| 238 | + static function($match) use ($fieldHelperChar) { |
|
| 239 | + return $match[1].$fieldHelperChar; |
|
| 240 | 240 | }, |
| 241 | 241 | $fieldArray |
| 242 | 242 | ); |
@@ -331,16 +331,16 @@ discard block |
||
| 331 | 331 | if ($htmlElement->id) { |
| 332 | 332 | $htmlElementHelperId = $htmlElement->id; |
| 333 | 333 | } elseif ($this->selector) { |
| 334 | - $htmlElementHelperId = 'html-element-validator-tmp-' . $this->selector; |
|
| 334 | + $htmlElementHelperId = 'html-element-validator-tmp-'.$this->selector; |
|
| 335 | 335 | } else { |
| 336 | 336 | $cssClassesTmp = \str_replace( |
| 337 | 337 | ' ', |
| 338 | 338 | '.', |
| 339 | 339 | $htmlElement->getAttribute('class') |
| 340 | 340 | ); |
| 341 | - $fakeCssSelector = $htmlElement->getNode()->getNodePath() . '/' . $cssClassesTmp; |
|
| 341 | + $fakeCssSelector = $htmlElement->getNode()->getNodePath().'/'.$cssClassesTmp; |
|
| 342 | 342 | |
| 343 | - $htmlElementHelperId = 'html-element-validator-tmp-' . $fakeCssSelector; |
|
| 343 | + $htmlElementHelperId = 'html-element-validator-tmp-'.$fakeCssSelector; |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | $htmlElementTagSelector = 'input, textarea, select'; |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | if ($inputType) { |
| 415 | 415 | $selectedRule = $this->autoSelectRuleByInputType($inputType); |
| 416 | 416 | if ($selectedRule) { |
| 417 | - $inputRule .= '|' . $selectedRule; |
|
| 417 | + $inputRule .= '|'.$selectedRule; |
|
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | 420 | |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | |
| 425 | 425 | $inputPattern = $htmlElementField->getAttribute('pattern'); |
| 426 | 426 | if ($inputPattern) { |
| 427 | - $inputRule .= '|regex(/' . $inputPattern . '/)'; |
|
| 427 | + $inputRule .= '|regex(/'.$inputPattern.'/)'; |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | // |
@@ -433,22 +433,22 @@ discard block |
||
| 433 | 433 | |
| 434 | 434 | $inputMinLength = $htmlElementField->getAttribute('minlength'); |
| 435 | 435 | if ($inputMinLength) { |
| 436 | - $inputRule .= '|minLength(' . \serialize($inputMinLength) . ')'; |
|
| 436 | + $inputRule .= '|minLength('.\serialize($inputMinLength).')'; |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | $inputMaxLength = $htmlElementField->getAttribute('maxlength'); |
| 440 | 440 | if ($inputMaxLength) { |
| 441 | - $inputRule .= '|maxLength(' . \serialize($inputMaxLength) . ')'; |
|
| 441 | + $inputRule .= '|maxLength('.\serialize($inputMaxLength).')'; |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | $inputMin = $htmlElementField->getAttribute('min'); |
| 445 | 445 | if ($inputMin) { |
| 446 | - $inputRule .= '|min(' . \serialize($inputMin) . ')'; |
|
| 446 | + $inputRule .= '|min('.\serialize($inputMin).')'; |
|
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | $inputMax = $htmlElementField->getAttribute('max'); |
| 450 | 450 | if ($inputMax) { |
| 451 | - $inputRule .= '|max(' . \serialize($inputMax) . ')'; |
|
| 451 | + $inputRule .= '|max('.\serialize($inputMax).')'; |
|
| 452 | 452 | } |
| 453 | 453 | } |
| 454 | 454 | |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | foreach ($htmlElementField->getElementsByTagName('option') as $option) { |
| 468 | 468 | $selectableValues[] = $option->getNode()->nodeValue; |
| 469 | 469 | } |
| 470 | - $inputRule .= '|in(' . \serialize($selectableValues) . ')'; |
|
| 470 | + $inputRule .= '|in('.\serialize($selectableValues).')'; |
|
| 471 | 471 | } elseif ( |
| 472 | 472 | ( |
| 473 | 473 | $inputType === 'checkbox' |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | ) { |
| 480 | 480 | $selectableValues = []; |
| 481 | 481 | |
| 482 | - $htmlElementFieldNames = $htmlElement->findMultiOrFalse('[name=\'' . $htmlElementField->getAttribute('name') . '\']'); |
|
| 482 | + $htmlElementFieldNames = $htmlElement->findMultiOrFalse('[name=\''.$htmlElementField->getAttribute('name').'\']'); |
|
| 483 | 483 | |
| 484 | 484 | if ($htmlElementFieldNames) { |
| 485 | 485 | foreach ($htmlElementFieldNames as $htmlElementFieldName) { |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | - $inputRule .= '|in(' . \serialize($selectableValues) . ')'; |
|
| 490 | + $inputRule .= '|in('.\serialize($selectableValues).')'; |
|
| 491 | 491 | } |
| 492 | 492 | } |
| 493 | 493 | |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | } |
| 653 | 653 | } catch (ComponentException $componentException) { |
| 654 | 654 | throw new UnknownValidationRule( |
| 655 | - 'No rule defined for: ' . $field . ' (rule: ' . $fieldRule . ' | class: ' . $validationClass . ')', |
|
| 655 | + 'No rule defined for: '.$field.' (rule: '.$fieldRule.' | class: '.$validationClass.')', |
|
| 656 | 656 | 500, |
| 657 | 657 | $componentException |
| 658 | 658 | ); |