Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Log / Filter / SuppressFilter.php
blob419154f589d0cebbe18cdd0ffd6d448a1d89dbf3
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Log\Filter;
12 use Traversable;
13 use Zend\Log\Exception;
15 class SuppressFilter implements FilterInterface
17 /**
18 * @var bool
20 protected $accept = true;
22 /**
23 * This is a simple boolean filter.
25 * @param int|array|Traversable $suppress
26 * @throws Exception\InvalidArgumentException
28 public function __construct($suppress = false)
30 if ($suppress instanceof Traversable) {
31 $suppress = iterator_to_array($suppress);
33 if (is_array($suppress)) {
34 $suppress = isset($suppress['suppress']) ? $suppress['suppress'] : false;
36 if (!is_bool($suppress)) {
37 throw new Exception\InvalidArgumentException(sprintf(
38 'Suppress must be an boolean; received "%s"', gettype($suppress)
39 ));
42 $this->suppress($suppress);
45 /**
46 * This is a simple boolean filter.
48 * Call suppress(true) to suppress all log events.
49 * Call suppress(false) to accept all log events.
51 * @param bool $suppress Should all log events be suppressed?
52 * @return void
54 public function suppress($suppress)
56 $this->accept = ! (bool) $suppress;
59 /**
60 * Returns TRUE to accept the message, FALSE to block it.
62 * @param array $event event data
63 * @return bool accepted?
65 public function filter(array $event)
67 return $this->accept;