mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-14 15:56:48 +03:00
Merge branch 'master' into 2.8
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
/.gitignore export-ignore
|
||||
/.gitattributes export-ignore
|
||||
/.travis.yml export-ignore
|
||||
/tests export-ignore
|
||||
/phpunit.xml.dist export-ignore
|
||||
/apigen.neon export-ignore
|
||||
@@ -1,3 +1,8 @@
|
||||
* 2.7.4 (2014-10-29)
|
||||
* Changed loop in `generateBytes()` from `foreach` to `for`; see #33
|
||||
* Use `toString()` in README examples to avoid confusion
|
||||
* Exclude build/development tools from releases using .gitattributes
|
||||
* Set timezone properly for tests
|
||||
* 2.7.3 (2014-08-27)
|
||||
* Fixed upper range for `mt_rand` used in version 4 UUIDs
|
||||
* 2.7.2 (2014-07-28)
|
||||
|
||||
@@ -59,21 +59,21 @@ use Rhumsaa\Uuid\Exception\UnsatisfiedDependencyException;
|
||||
|
||||
try {
|
||||
|
||||
// Generate a version 1 (time-based) UUID
|
||||
// Generate a version 1 (time-based) UUID object
|
||||
$uuid1 = Uuid::uuid1();
|
||||
echo $uuid1 . "\n"; // e4eaaaf2-d142-11e1-b3e4-080027620cdd
|
||||
echo $uuid1->toString() . "\n"; // e4eaaaf2-d142-11e1-b3e4-080027620cdd
|
||||
|
||||
// Generate a version 3 (name-based and hashed with MD5) UUID
|
||||
// Generate a version 3 (name-based and hashed with MD5) UUID object
|
||||
$uuid3 = Uuid::uuid3(Uuid::NAMESPACE_DNS, 'php.net');
|
||||
echo $uuid3 . "\n"; // 11a38b9a-b3da-360f-9353-a5a725514269
|
||||
echo $uuid3->toString() . "\n"; // 11a38b9a-b3da-360f-9353-a5a725514269
|
||||
|
||||
// Generate a version 4 (random) UUID
|
||||
// Generate a version 4 (random) UUID object
|
||||
$uuid4 = Uuid::uuid4();
|
||||
echo $uuid4 . "\n"; // 25769c6c-d34d-4bfe-ba98-e0ee856f3e7a
|
||||
echo $uuid4->toString() . "\n"; // 25769c6c-d34d-4bfe-ba98-e0ee856f3e7a
|
||||
|
||||
// Generate a version 5 (name-based and hashed with SHA1) UUID
|
||||
// Generate a version 5 (name-based and hashed with SHA1) UUID object
|
||||
$uuid5 = Uuid::uuid5(Uuid::NAMESPACE_DNS, 'php.net');
|
||||
echo $uuid5 . "\n"; // c4a760a8-dbcf-5254-a0d9-6a4474bd1b62
|
||||
echo $uuid5->toString() . "\n"; // c4a760a8-dbcf-5254-a0d9-6a4474bd1b62
|
||||
|
||||
} catch (UnsatisfiedDependencyException $e) {
|
||||
|
||||
|
||||
+1
-1
@@ -1225,7 +1225,7 @@ final class Uuid
|
||||
}
|
||||
|
||||
$bytes = '';
|
||||
foreach (range(1, $length) as $i) {
|
||||
for ($i = 1; $i <= $length; $i++) {
|
||||
$bytes = chr(mt_rand(0, 255)) . $bytes;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
// Ensure that composer has installed all dependencies
|
||||
if (!file_exists(dirname(__DIR__) . '/vendor/autoload.php')) {
|
||||
|
||||
Reference in New Issue
Block a user