-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathPrimitiveUuid.class.php
More file actions
43 lines (38 loc) · 1.33 KB
/
PrimitiveUuid.class.php
File metadata and controls
43 lines (38 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/***************************************************************************
* Copyright (C) 2012 by Georgiy T. Kutsurua *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation; either version 3 of the *
* License, or (at your option) any later version. *
* *
***************************************************************************/
/**
* @ingroup Primitives
**/
class PrimitiveUuid extends PrimitiveString
{
const UUID_PATTERN = '/^\{?[0-9a-f]{8}\-?[0-9a-f]{4}\-?[0-9a-f]{4}\-?[0-9a-f]{4}\-?[0-9a-f]{12}\}?$/i';
/**
* @param string $name
* @return PrimitiveUuid
*/
public static function create($name)
{
return new self($name);
}
public function __construct($name)
{
parent::__construct($name);
parent::setAllowedPattern(self::UUID_PATTERN);
}
/**
* @param $pattern
* @throws UnsupportedMethodException
*/
public function setAllowedPattern($pattern)
{
throw new UnsupportedMethodException('this method not supported yet!');
}
}