/library/Zend/Amf/Value/Messaging/AbstractMessage.php
https://github.com/jtai/zf2 · PHP · 96 lines · 26 code · 9 blank · 61 comment · 0 complexity · fcc9537d36fe5ae0a01559f16899a40c MD5 · raw file
- <?php
- /**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Amf
- * @subpackage Value
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
- /**
- * @namespace
- */
- namespace Zend\Amf\Value\Messaging;
- /**
- * This is the default Implementation of Message, which provides
- * a convenient base for behavior and association of common endpoints
- *
- * @package Zend_Amf
- * @subpackage Value
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
- class AbstractMessage
- {
- /**
- * @var string Client identifier
- */
- public $clientId;
- /**
- * @var string Destination
- */
- public $destination;
- /**
- * @var string Message identifier
- */
- public $messageId;
- /**
- * @var int Message timestamp
- */
- public $timestamp;
- /**
- * @var int Message TTL
- */
- public $timeToLive;
- /**
- * @var object Message headers
- */
- public $headers;
- /**
- * @var string Message body
- */
- public $body;
- /**
- * generate a unique id
- *
- * Format is: ########-####-####-####-############
- * Where # is an uppercase letter or number
- * example: 6D9DC7EC-A273-83A9-ABE3-00005FD752D6
- *
- * @return string
- */
- public function generateId()
- {
- return sprintf(
- '%08X-%04X-%04X-%02X%02X-%012X',
- mt_rand(),
- mt_rand(0, 65535),
- bindec(substr_replace(
- sprintf('%016b', mt_rand(0, 65535)), '0100', 11, 4)
- ),
- bindec(substr_replace(sprintf('%08b', mt_rand(0, 255)), '01', 5, 2)),
- mt_rand(0, 255),
- mt_rand()
- );
- }
- }