Skip to content

Commit

Permalink
Merge branch 'master' into 2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
ramsey committed Oct 30, 2014
2 parents 0878935 + 94b0103 commit 2189e9c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
2 changes: 1 addition & 1 deletion src/Uuid.php
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ private static function generateBytes($length)
}

$bytes = '';
foreach (range(1, $length) as $i) {
for ($i = 1; $i <= $length; $i++) {
$bytes = chr(mt_rand(0, 255)) . $bytes;
}

Expand Down
1 change: 1 addition & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -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')) {
Expand Down

0 comments on commit 2189e9c

Please sign in to comment.