You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Database/Validator/Key.php
+7-5Lines changed: 7 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -11,12 +11,12 @@ class Key extends Validator
11
11
/**
12
12
* Maximum length for Key validation
13
13
*/
14
-
protectedconstKEY_MAX_LENGTH = 255;
14
+
protectedint$maxLength;
15
15
16
16
/**
17
17
* @var string
18
18
*/
19
-
protectedstring$message = 'Parameter must contain at most ' . self::KEY_MAX_LENGTH . ' chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char';
19
+
protectedstring$message;
20
20
21
21
/**
22
22
* Get Description.
@@ -33,9 +33,11 @@ public function getDescription(): string
$this->message = 'Parameter must contain at most ' . $this->maxLength . ' chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char';
39
41
}
40
42
41
43
/**
@@ -81,8 +83,8 @@ public function isValid($value): bool
81
83
if (\preg_match('/[^A-Za-z0-9\_\-\.]/', $value)) {
Copy file name to clipboardExpand all lines: src/Database/Validator/UID.php
+9-1Lines changed: 9 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,14 @@
4
4
5
5
classUIDextends Key
6
6
{
7
+
/**
8
+
* Expression constructor
9
+
*/
10
+
publicfunction__construct(int$maxLength = 255)
11
+
{
12
+
parent::__construct(false, $maxLength);
13
+
}
14
+
7
15
/**
8
16
* Get Description.
9
17
*
@@ -13,6 +21,6 @@ class UID extends Key
13
21
*/
14
22
publicfunctiongetDescription(): string
15
23
{
16
-
return'UID must contain at most ' . self::KEY_MAX_LENGTH . ' chars. Valid chars are a-z, A-Z, 0-9, and underscore. Can\'t start with a leading underscore';
24
+
return'UID must contain at most ' . $this->maxLength . ' chars. Valid chars are a-z, A-Z, 0-9, and underscore. Can\'t start with a leading underscore';
0 commit comments