add a stub debug() method to aid in debugging
authorChuck Hagenbuch <chuck@horde.org>
Fri, 22 May 2009 02:18:11 +0000 (22:18 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Fri, 22 May 2009 15:57:32 +0000 (11:57 -0400)
framework/Date_Parser/lib/Horde/Date/Parser/Locale/Base.php

index 4e65270..5cf3388 100644 (file)
@@ -258,6 +258,7 @@ class Horde_Date_Parser_Locale_Base
         foreach ($this->definitions['date'] as $handler) {
             if ($handler->match($tokens, $this->definitions)) {
                 $goodTokens = array_values(array_filter($tokens, create_function('$o', 'return !$o->getTag("separator");')));
+                $this->debug($handler->handlerMethod, $goodTokens, $options);
                 return call_user_func(array($this, $handler->handlerMethod), $goodTokens, $options);
             }
         }
@@ -266,6 +267,7 @@ class Horde_Date_Parser_Locale_Base
         foreach ($this->definitions['anchor'] as $handler) {
             if ($handler->match($tokens, $this->definitions)) {
                 $goodTokens = array_values(array_filter($tokens, create_function('$o', 'return !$o->getTag("separator");')));
+                $this->debug($handler->handlerMethod, $goodTokens, $options);
                 return call_user_func(array($this, $handler->handlerMethod), $goodTokens, $options);
             }
         }
@@ -274,6 +276,7 @@ class Horde_Date_Parser_Locale_Base
         foreach ($this->definitions['arrow'] as $handler) {
             if ($handler->match($tokens, $this->definitions)) {
                 $goodTokens = array_values(array_filter($tokens, create_function('$o', 'return !$o->getTag("separator_at") && !$o->getTag("separator_slash_or_dash") && !$o->getTag("separator_comma");')));
+                $this->debug($handler->handlerMethod, $goodTokens, $options);
                 return call_user_func(array($this, $handler->handlerMethod), $goodTokens, $options);
             }
         }
@@ -282,6 +285,7 @@ class Horde_Date_Parser_Locale_Base
         foreach ($this->definitions['narrow'] as $handler) {
             if ($handler->match($tokens, $this->definitions)) {
                 //good_tokens = tokens.select { |o| !o.get_tag Separator }
+                $this->debug($handler->handlerMethod, $tokens, $options);
                 return call_user_func(array($this, $handler->handlerMethod), $tokens, $options);
             }
         }
@@ -289,7 +293,6 @@ class Horde_Date_Parser_Locale_Base
         return null;
     }
 
-
     public function dayOrTime($dayStart, $timeTokens, $options)
     {
         $outerSpan = new Horde_Date_Span($dayStart, $dayStart->add(array('day' => 1)));
@@ -498,6 +501,18 @@ class Horde_Date_Parser_Locale_Base
 
 
     /*##########################################################################
+    # Logging Methods
+    ##########################################################################*/
+
+    public function debug($method, $args)
+    {
+        $args = func_get_args();
+        $method = array_shift($args);
+        // echo "$method\n";
+    }
+
+
+    /*##########################################################################
     # Support Methods
     ##########################################################################*/