PageRenderTime 63ms CodeModel.GetById 37ms RepoModel.GetById 1ms app.codeStats 0ms

/library/Zend/Log/Filter/Suppress.php

https://bitbucket.org/philkershaw/zend-framework-1.11-acl-implementation
PHP | 77 lines | 18 code | 5 blank | 54 comment | 0 complexity | 6c78af6999cc66ac65693e24322cb376 MD5 | raw file
Possible License(s): LGPL-3.0
  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_Log
  17. * @subpackage Filter
  18. * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id: Suppress.php 23775 2011-03-01 17:25:24Z ralph $
  21. */
  22. /** Zend_Log_Filter_Interface */
  23. require_once 'Zend/Log/Filter/Abstract.php';
  24. /**
  25. * @category Zend
  26. * @package Zend_Log
  27. * @subpackage Filter
  28. * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
  29. * @license http://framework.zend.com/license/new-bsd New BSD License
  30. * @version $Id: Suppress.php 23775 2011-03-01 17:25:24Z ralph $
  31. */
  32. class Zend_Log_Filter_Suppress extends Zend_Log_Filter_Abstract
  33. {
  34. /**
  35. * @var boolean
  36. */
  37. protected $_accept = true;
  38. /**
  39. * This is a simple boolean filter.
  40. *
  41. * Call suppress(true) to suppress all log events.
  42. * Call suppress(false) to accept all log events.
  43. *
  44. * @param boolean $suppress Should all log events be suppressed?
  45. * @return void
  46. */
  47. public function suppress($suppress)
  48. {
  49. $this->_accept = (! $suppress);
  50. }
  51. /**
  52. * Returns TRUE to accept the message, FALSE to block it.
  53. *
  54. * @param array $event event data
  55. * @return boolean accepted?
  56. */
  57. public function accept($event)
  58. {
  59. return $this->_accept;
  60. }
  61. /**
  62. * Create a new instance of Zend_Log_Filter_Suppress
  63. *
  64. * @param array|Zend_Config $config
  65. * @return Zend_Log_Filter_Suppress
  66. * @throws Zend_Log_Exception
  67. */
  68. static public function factory($config)
  69. {
  70. return new self();
  71. }
  72. }