/zf2/vendor/Zend/Amf/Value/Messaging/AbstractMessage.php
PHP | 96 lines | 26 code | 9 blank | 61 comment | 0 complexity | 7feee86700b3d393fe2394760a2a7c67 MD5 | raw file
Possible License(s): MIT, BSD-3-Clause, Apache-2.0, LGPL-2.1, LGPL-3.0, BSD-2-Clause
- <?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-2011 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-2011 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()
- );
- }
- }