You are here

protected function EventHandler::generateUuid in Services Client 7.2

Generates a UUID v4 using PHP code.

Based on code from

See also

http://php.net/uniqid#65879 , but corrected.

1 call to EventHandler::generateUuid()
EventHandler::addPlugin in include/event.inc
Add configuration plugin.

File

include/event.inc, line 521

Class

EventHandler
Event handler plugin.

Code

protected function generateUuid() {

  // The field names refer to RFC 4122 section 4.1.2.
  return sprintf('%04x%04x-%04x-4%03x-%04x-%04x%04x%04x', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 4095), bindec(substr_replace(sprintf('%016b', mt_rand(0, 65535)), '10', 0, 2)), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
}