require 5.4 and add JsonSerializable

This commit is contained in:
Greg Brown
2014-07-22 23:20:43 -07:00
parent 1aa26b0143
commit 45c34cd709
3 changed files with 16 additions and 2 deletions
+1
View File
@@ -1,3 +1,4 @@
.idea/
*.phar
.DS_Store
build
+1 -1
View File
@@ -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
View File
@@ -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.
*