Exemplo n.º 1
0
 /**
  * @brief Generates a Universally Unique IDentifier, version 1, 3, 4 or 5.
  *
  * This function generates a truly random UUID. The built in CakePHP String::uuid() function
  * is not cryptographically secure. You should uses this function instead.
  *
  * @see http://tools.ietf.org/html/rfc4122#section-4.4
  * @see http://en.wikipedia.org/wiki/UUID
  * @return string A UUID, made up of 32 hex digits and 4 hyphens.
  */
 function generate($version = null, $ns = null, $name = null)
 {
     if ($version == null) {
         $version = $this->version;
     }
     switch ($version) {
         case Uuid::UUID_V1:
             return Uuid::v1();
         case Uuid::UUID_V3:
             return Uuid::v3($ns, $name);
         case Uuid::UUID_V4:
             return Uuid::v4();
         case Uuid::UUID_V5:
             return Uuid::v5($ns, $name);
     }
 }