Author: ts
Date: Wed Jan 16 16:04:04 2008
New Revision: 7162

Log:
- Implemented enhancement #10925: Include filenames and linenumbers in error
  output.

Modified:
    scripts/docanalysis/src/analysis/element.php
    scripts/docanalysis/src/reporters/plain.php

Modified: scripts/docanalysis/src/analysis/element.php
==============================================================================
--- scripts/docanalysis/src/analysis/element.php [iso-8859-1] (original)
+++ scripts/docanalysis/src/analysis/element.php [iso-8859-1] Wed Jan 16 
16:04:04 2008
@@ -44,6 +44,14 @@
         if ( $propertyName === "name" )
         {
             return $this->getName();
+        }
+        if ( $propertyName === 'line' )
+        {
+            return $this->getLine();
+        }
+        if ( $propertyName === 'file' )
+        {
+            return $this->getFile();
         }
         throw new ezcBasePropertyNotFoundException( $propertyName );
     }
@@ -94,6 +102,36 @@
         }
         return "<<unkown>>";
     }
+
+    protected function getLine()
+    {
+        switch ( get_class( $this->element ) )
+        {
+            case 'ezcDocFileReflection':
+            case 'ezcDocComponentReflection':
+                return 0;
+            case 'ReflectionClass':
+            case 'ReflectionMethod':
+                return $this->element->getStartLine();
+            case 'ReflectionProperty':
+                return $this->element->getDeclaringClass()->getStartLine();
+        }
+    }
+
+    protected function getFile()
+    {
+        switch ( get_class( $this->element ) )
+        {
+            case 'ezcDocFileReflection':
+            case 'ezcDocComponentReflection':
+                return $this->element->getName();
+            case 'ReflectionClass':
+            case 'ReflectionMethod':
+                return $this->element->getFileName();
+            case 'ReflectionProperty':
+                return $this->element->getDeclaringClass()->getFileName();
+        }
+    }
 }
 
 ?>

Modified: scripts/docanalysis/src/reporters/plain.php
==============================================================================
--- scripts/docanalysis/src/reporters/plain.php [iso-8859-1] (original)
+++ scripts/docanalysis/src/reporters/plain.php [iso-8859-1] Wed Jan 16 
16:04:04 2008
@@ -28,7 +28,7 @@
         
         if ( count( $analysisElement->messages ) !== 0 )
         {
-            $this->output->outputLine( $this->indent( 
"{$analysisElement->name} (" . count( $analysisElement->messages ) . " 
messages)", $level ) );
+            $this->output->outputLine( $this->indent( 
"{$analysisElement->name} (" . count( $analysisElement->messages ) . " 
messages), file: {$analysisElement->file}, line: {$analysisElement->line}", 
$level ) );
         }
         foreach( $analysisElement->messages as $message )
         {


-- 
svn-components mailing list
[EMAIL PROTECTED]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to