Use named constants (Horde_Log_Filter::ACCEPT, Horde_Log_Filter::IGNORE) for clarity...
authorChuck Hagenbuch <chuck@horde.org>
Mon, 19 Jul 2010 01:40:14 +0000 (21:40 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Mon, 19 Jul 2010 01:40:14 +0000 (21:40 -0400)
framework/Log/lib/Horde/Log/Filter.php
framework/Log/lib/Horde/Log/Filter/Constraint.php
framework/Log/lib/Horde/Log/Filter/Level.php
framework/Log/lib/Horde/Log/Filter/Message.php
framework/Log/lib/Horde/Log/Filter/Suppress.php

index f795d06..8a0b297 100644 (file)
 interface Horde_Log_Filter
 {
     /**
-     * Returns TRUE to accept the message, FALSE to block it.
+     * Accept a message
+     */
+    const ACCEPT = true;
+
+    /**
+     * Filter out a message
+     */
+    const IGNORE = false;
+
+    /**
+     * Returns Horde_Log_Filter::ACCEPT to accept the message,
+     * Horde_Log_Filter::IGNORE to ignore it.
      *
      * @param  array    $event    Log event
      * @return boolean            accepted?
index f68ea6a..d7e42b8 100644 (file)
@@ -109,7 +109,8 @@ class Horde_Log_Filter_Constraint implements Horde_Log_Filter
     }
 
     /**
-     * Returns TRUE to accept the message, FALSE to block it.
+     * Returns Horde_Log_Filter::ACCEPT to accept the message,
+     * Horde_Log_Filter::IGNORE to ignore it.
      *
      * @param  array    $event    Log event
      * @return boolean            accepted?
@@ -119,9 +120,9 @@ class Horde_Log_Filter_Constraint implements Horde_Log_Filter
         foreach ($this->_constraints as $field => $constraint) {
             $value = isset($event[$field]) ? $event[$field] : null;
             if (!$constraint->evaluate($value)) {
-                return false;
+                return Horde_Log_Filter::IGNORE;
             }
         }
-        return true;
+        return Horde_Log_Filter::ACCEPT;
     }
 }
index 51abf4c..4a7a248 100644 (file)
@@ -42,7 +42,8 @@ class Horde_Log_Filter_Level implements Horde_Log_Filter
     }
 
     /**
-     * Returns TRUE to accept the message, FALSE to block it.
+     * Returns Horde_Log_Filter::ACCEPT to accept the message,
+     * Horde_Log_Filter::IGNORE to ignore it.
      *
      * @param  array    $event    Log event
      * @return boolean            accepted?
index 0dddffb..e0da1ee 100644 (file)
@@ -44,7 +44,8 @@ class Horde_Log_Filter_Message implements Horde_Log_Filter
     }
 
     /**
-     * Returns TRUE to accept the message, FALSE to block it.
+     * Returns Horde_Log_Filter::ACCEPT to accept the message,
+     * Horde_Log_Filter::IGNORE to ignore it.
      *
      * @param  array    $event    Log event
      * @return boolean            accepted?
index 02f3500..2b3f9cb 100644 (file)
@@ -27,7 +27,7 @@ class Horde_Log_Filter_Suppress implements Horde_Log_Filter
     /**
      * @var boolean
      */
-    protected $_accept = true;
+    protected $_accept = Horde_Log_Filter::ACCEPT;
 
     /**
      * This is a simple boolean filter.
@@ -44,7 +44,8 @@ class Horde_Log_Filter_Suppress implements Horde_Log_Filter
     }
 
     /**
-     * Returns TRUE to accept the message, FALSE to block it.
+     * Returns Horde_Log_Filter::ACCEPT to accept the message,
+     * Horde_Log_Filter::IGNORE to ignore it.
      *
      * @param  array    $event    event data
      * @return boolean            accepted?