Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- /**
- * ILLI
- *
- * @category ILLI_System
- * @package ILLI
- * @link http://illi.be
- * @license http://l.illi.be
- * @copyright ILLI Conference
- */
- NAMESPACE ILLI\System;
- /**
- * ILLI Initial Object
- *
- * @category ILLI_Boot
- * @package ILLI
- * @subpackage Boot
- * @namespace ILLI\Boot
- * @link http://illi.be
- * @license http://l.illi.be
- * @copyright ILLI Conference
- * @since 2.0.1
- * @version 3.0.1
- */
- CLASS UUID EXTENDS Object
- {
- /**
- * @const int 00001111
- */
- const UUID_VERSION_CLEAR = 15;
- /**
- * @const int 01000000
- */
- const UUID_VERSION_4 = 64;
- /**
- * @const int 00111111
- */
- const UUID_VARIANT_CLEAR = 63;
- /**
- * @const int 10000000
- */
- const UUID_VARIANT_RFC = 128;
- /**
- * result
- */
- private $__value = '';
- public function __construct()
- {
- parent::__construct();
- $uuid = (string) new Rand(16);
- $uuid[6] = chr(ord($uuid[6]) & static::UUID_VERSION_CLEAR | static::UUID_VERSION_4);
- $uuid[8] = chr(ord($uuid[8]) & static::UUID_VARIANT_CLEAR | static::UUID_VARIANT_RFC);
- $this->__value = implode('-', array(
- bin2hex(substr($uuid, 0, 4)),
- bin2hex(substr($uuid, 4, 2)),
- bin2hex(substr($uuid, 6, 2)),
- bin2hex(substr($uuid, 8, 2)),
- bin2hex(substr($uuid, 10, 6))
- ));
- }
- public function __tostring()
- {
- return $this->__value;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement