Skip to content

Commit 3bade65

Browse files
author
Viktor Sevch
committed
MC-39885: Improve customer api
1 parent dd09734 commit 3bade65

File tree

1 file changed

+3
-2
lines changed
  • app/code/Magento/Customer/Model/Validator

1 file changed

+3
-2
lines changed

app/code/Magento/Customer/Model/Validator/Name.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
class Name extends AbstractValidator
1717
{
18+
const PATTERN_NAME = '/(?:[\p{L}\p{M}\,\-\_\.\'\s\d]){1,255}+/u';
19+
1820
/**
1921
* Validate name fields.
2022
*
@@ -47,8 +49,7 @@ public function isValid($customer)
4749
private function isValidName($nameValue)
4850
{
4951
if ($nameValue != null) {
50-
$pattern = '/(?:[\p{L}\p{M}\,\-\_\.\'\"\s\d]){1,255}+/u';
51-
if (preg_match($pattern, $nameValue, $matches)) {
52+
if (preg_match(self::PATTERN_NAME, $nameValue, $matches)) {
5253
return $matches[0] == $nameValue;
5354
}
5455
}

0 commit comments

Comments
 (0)