Rename getMap() to __toString().
authorJan Schneider <jan@horde.org>
Sat, 28 Aug 2010 09:37:12 +0000 (11:37 +0200)
committerJan Schneider <jan@horde.org>
Sat, 28 Aug 2010 09:43:18 +0000 (11:43 +0200)
framework/Cli/lib/Horde/Cli.php
framework/Core/lib/Horde.php
framework/Support/lib/Horde/Support/Backtrace.php
framework/Support/test/Horde/Support/BacktraceTest.php

index 5d4ac48..38f0f8b 100644 (file)
@@ -319,7 +319,7 @@ class Horde_Cli
         $this->writeln($this->red(_("Fatal Error:")));
         $this->writeln($this->red($error));
         $this->writeln();
-        $this->writeln($backtrace->getMap());
+        $this->writeln((string)$backtrace);
         $this->writeln($this->red('===================='));
         exit(1);
     }
index 68a7c95..4e0ea83 100644 (file)
@@ -121,7 +121,7 @@ class Horde
                 $trace = debug_backtrace();
             }
             $backtrace = new Horde_Support_Backtrace($trace);
-            $errortext .= '<div id="backtrace"><pre>' . $backtrace->getMap() . '</pre></div>';
+            $errortext .= '<div id="backtrace"><pre>' . (string)$backtrace . '</pre></div>';
             if (is_object($error)) {
                 $errortext .= '<h3>' . _("Details") . '</h3>';
                 $errortext .= '<h4>' . _("The full error message is logged in Horde's log file, and is shown below only to administrators. Non-administrative users will not see error details.") . '</h4>';
index 7a80e01..29a22a0 100644 (file)
@@ -117,7 +117,7 @@ class Horde_Support_Backtrace
      *
      * @return string  The backtrace map.
      */
-    public function getMap()
+    public function __toString()
     {
         $count = count($this->_backtrace);
         $pad = strlen($count);
index 12d25e6..5353488 100644 (file)
@@ -84,16 +84,16 @@ class Horde_Support_BacktraceTest extends PHPUnit_Framework_TestCase
         $this->assertEquals(count($dbt), $backtrace->getNestingLevel());
     }
 
-    public function testGetMap()
+    public function testToString()
     {
         $backtrace = new Horde_Support_Backtrace(array_slice($this->instanceMethod(), 0, 4));
         $file = __FILE__;
-        $this->assertEquals("1. Horde_Support_BacktraceTest->testGetMap()
+        $this->assertEquals("1. Horde_Support_BacktraceTest->testToString()
 2. Horde_Support_BacktraceTest->instanceMethod() $file:89
 3. Horde_Support_BacktraceTest::staticMethod() $file:29
 4. backtraceTestFunction() $file:34
 ",
-                            $backtrace->getMap());
+                            (string)$backtrace);
     }
 
     public function returnBacktrace()