File indexing completed on 2025-03-02 05:29:10
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_Amf 0017 * @subpackage Value 0018 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0019 * @license http://framework.zend.com/license/new-bsd New BSD License 0020 * @version $Id$ 0021 */ 0022 0023 /** 0024 * This is the default Implementation of Message, which provides 0025 * a convenient base for behavior and association of common endpoints 0026 * 0027 * @package Zend_Amf 0028 * @subpackage Value 0029 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0030 * @license http://framework.zend.com/license/new-bsd New BSD License 0031 */ 0032 class Zend_Amf_Value_Messaging_AbstractMessage 0033 { 0034 /** 0035 * @var string Client identifier 0036 */ 0037 public $clientId; 0038 0039 /** 0040 * @var string Destination 0041 */ 0042 public $destination; 0043 0044 /** 0045 * @var string Message identifier 0046 */ 0047 public $messageId; 0048 0049 /** 0050 * @var int Message timestamp 0051 */ 0052 public $timestamp; 0053 0054 /** 0055 * @var int Message TTL 0056 */ 0057 public $timeToLive; 0058 0059 /** 0060 * @var object Message headers 0061 */ 0062 public $headers; 0063 0064 /** 0065 * @var string Message body 0066 */ 0067 public $body; 0068 0069 /** 0070 * generate a unique id 0071 * 0072 * Format is: ########-####-####-####-############ 0073 * Where # is an uppercase letter or number 0074 * example: 6D9DC7EC-A273-83A9-ABE3-00005FD752D6 0075 * 0076 * @return string 0077 */ 0078 public function generateId() 0079 { 0080 return sprintf( 0081 '%08X-%04X-%04X-%02X%02X-%012X', 0082 mt_rand(), 0083 mt_rand(0, 65535), 0084 bindec(substr_replace( 0085 sprintf('%016b', mt_rand(0, 65535)), '0100', 11, 4) 0086 ), 0087 bindec(substr_replace(sprintf('%08b', mt_rand(0, 255)), '01', 5, 2)), 0088 mt_rand(0, 255), 0089 mt_rand() 0090 ); 0091 } 0092 }