Namespace.php
00001 <?php
00009 class Dsao_Log_Filter_Namespace implements Zend_Log_Filter_Interface
00010 {
00014 protected $_namespaces = array();
00015
00023 public function accept($event)
00024 {
00025
00026 if (!isset($event['namespace']) || null === $event['namespace'])
00027 {
00028 return true;
00029 }
00030
00031
00032 $arrayNamespace = explode('::', $event['namespace'], 2);
00033
00034
00035
00036 if (isset($this->_namespace[$arrayNamespace[0]])
00037 || isset($this->_namespace[$event['namespace']]))
00038 {
00039 return false;
00040 }
00041
00042 return true;
00043 }
00044
00051 public function suppress($namespace)
00052 {
00053 $this->_namespaces[$namespace] = true;
00054
00055 return $this;
00056 }
00057
00068 public function unsuppress($namespace = null)
00069 {
00070 if (null === $namespace)
00071 {
00072 $this->_namespace = array();
00073 }
00074
00075 else if (isset($this->_namespace[$namespace]))
00076 {
00077 unset($this->_namespace[$namespace]);
00078 }
00079
00080 return $this;
00081 }
00082 }