PageRenderTime 59ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/php/HTML/Progress/observer.php

https://bitbucket.org/adarshj/convenient_website
PHP | 92 lines | 15 code | 5 blank | 72 comment | 0 complexity | 35db68c95f4332036bbac364ec690fe0 MD5 | raw file
Possible License(s): Apache-2.0, MPL-2.0-no-copyleft-exception, LGPL-2.1, BSD-2-Clause, GPL-2.0, LGPL-3.0
  1. <?php
  2. /**
  3. * The HTML_Progress_Observer implements the observer pattern
  4. * for watching progress bar activity and taking actions
  5. * on exceptional events.
  6. *
  7. * PHP versions 4 and 5
  8. *
  9. * LICENSE: This source file is subject to version 3.0 of the PHP license
  10. * that is available through the world-wide-web at the following URI:
  11. * http://www.php.net/license/3_0.txt. If you did not receive a copy of
  12. * the PHP License and are unable to obtain it through the web, please
  13. * send a note to license@php.net so we can mail you a copy immediately.
  14. *
  15. * @category HTML
  16. * @package HTML_Progress
  17. * @subpackage Progress_Observer
  18. * @author Laurent Laville <pear@laurent-laville.org>
  19. * @copyright 1997-2005 The PHP Group
  20. * @license http://www.php.net/license/3_0.txt PHP License 3.0
  21. * @version CVS: $Id: observer.php,v 1.4 2005/07/25 13:02:33 farell Exp $
  22. * @link http://pear.php.net/package/HTML_Progress
  23. */
  24. /**
  25. * The HTML_Progress_Observer implements the observer pattern
  26. * for watching progress bar activity and taking actions
  27. * on exceptional events.
  28. *
  29. * PHP versions 4 and 5
  30. *
  31. * LICENSE: This source file is subject to version 3.0 of the PHP license
  32. * that is available through the world-wide-web at the following URI:
  33. * http://www.php.net/license/3_0.txt. If you did not receive a copy of
  34. * the PHP License and are unable to obtain it through the web, please
  35. * send a note to license@php.net so we can mail you a copy immediately.
  36. *
  37. * @category HTML
  38. * @package HTML_Progress
  39. * @subpackage Progress_Observer
  40. * @author Laurent Laville <pear@laurent-laville.org>
  41. * @copyright 1997-2005 The PHP Group
  42. * @license http://www.php.net/license/3_0.txt PHP License 3.0
  43. * @version Release: 1.2.2
  44. * @link http://pear.php.net/package/HTML_Progress
  45. */
  46. class HTML_Progress_Observer
  47. {
  48. /**
  49. * Instance-specific unique identification number.
  50. *
  51. * @var integer
  52. * @since 1.0
  53. * @access private
  54. */
  55. var $_id;
  56. /**
  57. * Creates a new basic HTML_Progress_Observer instance.
  58. *
  59. * @since 1.0
  60. * @access public
  61. */
  62. function HTML_Progress_Observer()
  63. {
  64. $this->_id = md5(microtime());
  65. }
  66. /**
  67. * This is a stub method to make sure that HTML_Progress_Observer classes do
  68. * something when they are notified of a message. The default behavior
  69. * is to just write into a file 'progress_observer.log' in current directory.
  70. * You should override this method.
  71. *
  72. * Default events :
  73. * - setMinimum
  74. * - setMaximum
  75. * - setValue
  76. *
  77. * @param mixed $event A hash describing the progress event.
  78. * @since 1.0
  79. * @access public
  80. */
  81. function notify($event)
  82. {
  83. $msg = (is_array($event)) ? serialize($event) : $event;
  84. error_log ("$msg \n", 3, 'progress_observer.log');
  85. }
  86. }
  87. ?>