mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-24 17:35:57 +03:00
require 5.4 and add JsonSerializable
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
.idea/
|
||||
*.phar
|
||||
.DS_Store
|
||||
build
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
"source": "https://github.com/ramsey/uuid"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
"php": ">=5.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"moontoast/math": "~1.1",
|
||||
|
||||
+14
-1
@@ -29,7 +29,7 @@ use InvalidArgumentException;
|
||||
* @link http://docs.python.org/3/library/uuid.html
|
||||
* @link http://docs.oracle.com/javase/6/docs/api/java/util/UUID.html
|
||||
*/
|
||||
final class Uuid
|
||||
final class Uuid implements \JsonSerializable
|
||||
{
|
||||
/**
|
||||
* When this namespace is specified, the name string is a fully-qualified domain name.
|
||||
@@ -175,6 +175,19 @@ final class Uuid
|
||||
return $this->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts this UUID object to a string when the object is serialized
|
||||
* with json_encode()
|
||||
*
|
||||
* @link http://php.net/manual/en/class.jsonserializable.php
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this UUID with the specified UUID.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user