PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/library/Zend/Wildfire/Plugin/FirePhp/Message.php

https://bitbucket.org/baruffaldi/webapp-urltube
PHP | 195 lines | 60 code | 19 blank | 116 comment | 0 complexity | 95af5be7055842df14256949ea92270e MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.0, MIT
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Wildfire
  17. * @subpackage Plugin
  18. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /**
  22. * A message envelope that can be passed to Zend_Wildfire_Plugin_FirePhp to be
  23. * logged to Firebug instead of a variable.
  24. *
  25. * @category Zend
  26. * @package Zend_Wildfire
  27. * @subpackage Plugin
  28. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  29. * @license http://framework.zend.com/license/new-bsd New BSD License
  30. */
  31. class Zend_Wildfire_Plugin_FirePhp_Message
  32. {
  33. /**
  34. * The style of the message
  35. * @var string
  36. */
  37. protected $_style = null;
  38. /**
  39. * The label of the message
  40. * @var string
  41. */
  42. protected $_label = null;
  43. /**
  44. * The message value
  45. * @var mixed
  46. */
  47. protected $_message = null;
  48. /**
  49. * Flag indicating if message buffering is enabled
  50. * @var boolean
  51. */
  52. protected $_buffered = false;
  53. /**
  54. * Flag indicating if message should be destroyed and not delivered
  55. * @var boolean
  56. */
  57. protected $_destroy = false;
  58. /**
  59. * Random unique ID used to identify message in comparison operations
  60. * @var string
  61. */
  62. protected $_ruid = false;
  63. /**
  64. * Creates a new message with the given style and message
  65. *
  66. * @param string $style Style of the message.
  67. * @param mixed $message The message
  68. * @return void
  69. */
  70. function __construct($style, $message)
  71. {
  72. $this->_style = $style;
  73. $this->_message = $message;
  74. $this->_ruid = md5(microtime().mt_rand());
  75. }
  76. /**
  77. * Set the label of the message
  78. *
  79. * @param string $label The label to be set
  80. * @return void
  81. */
  82. public function setLabel($label)
  83. {
  84. $this->_label = $label;
  85. }
  86. /**
  87. * Get the label of the message
  88. *
  89. * @return string The label of the message
  90. */
  91. public function getLabel()
  92. {
  93. return $this->_label;
  94. }
  95. /**
  96. * Enable or disable message buffering
  97. *
  98. * If a message is buffered it can be updated for the duration of the
  99. * request and is only flushed at the end of the request.
  100. *
  101. * @param boolean $buffered TRUE to enable buffering FALSE otherwise
  102. * @return boolean Returns previous buffering value
  103. */
  104. public function setBuffered($buffered)
  105. {
  106. $previous = $this->_buffered;
  107. $this->_buffered = $buffered;
  108. return $previous;
  109. }
  110. /**
  111. * Determine if buffering is enabled or disabled
  112. *
  113. * @return boolean Returns TRUE if buffering is enabled, FALSE otherwise.
  114. */
  115. public function getBuffered()
  116. {
  117. return $this->_buffered;
  118. }
  119. /**
  120. * Destroy the message to prevent delivery
  121. *
  122. * @param boolean $destroy TRUE to destroy FALSE otherwise
  123. * @return boolean Returns previous destroy value
  124. */
  125. public function setDestroy($destroy)
  126. {
  127. $previous = $this->_destroy;
  128. $this->_destroy = $destroy;
  129. return $previous;
  130. }
  131. /**
  132. * Determine if message should be destroyed
  133. *
  134. * @return boolean Returns TRUE if message should be destroyed, FALSE otherwise.
  135. */
  136. public function getDestroy()
  137. {
  138. return $this->_destroy;
  139. }
  140. /**
  141. * Set the style of the message
  142. *
  143. * @return void
  144. */
  145. public function setStyle($style)
  146. {
  147. $this->_style = $style;
  148. }
  149. /**
  150. * Get the style of the message
  151. *
  152. * @return string The style of the message
  153. */
  154. public function getStyle()
  155. {
  156. return $this->_style;
  157. }
  158. /**
  159. * Set the actual message to be sent in its final format.
  160. *
  161. * @return void
  162. */
  163. public function setMessage($message)
  164. {
  165. $this->_message = $message;
  166. }
  167. /**
  168. * Get the actual message to be sent in its final format.
  169. *
  170. * @return mixed Returns the message to be sent.
  171. */
  172. public function getMessage()
  173. {
  174. return $this->_message;
  175. }
  176. }