Skip to content

Commit 458ac53

Browse files
committed
Merge pull request #1 from LearningLocker/issue/uuid-variant
Fixes variant checking.
2 parents 9ca35be + 720da91 commit 458ac53

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/RegexpAtom.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class RegexpAtom extends Atom {
77
protected static $invalid_message;
88

99
protected function getInvalidMessage() {
10-
return static::$invalid_message ?: '`'.$this->value.'` should be a valid `' . get_class($this) . '`';
10+
return static::$invalid_message .'`'.$this->value.'` should be a valid `' . get_class($this) . '`';
1111
}
1212

1313
public function validate() {

src/UUID.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php namespace Locker\XApi;
22

33
class UUID extends RegexpAtom {
4-
protected static $pattern = '/^\{?[A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12}\}?$/i';
4+
protected static $pattern = '/^\{?[A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[8,9,a,b][A-Z0-9]{3}-[A-Z0-9]{12}\}?$/i';
5+
protected static $invalid_message = 'Only versions of variant 2 in RFC 4122 are valid. ';
56
}

0 commit comments

Comments
 (0)