Changeset 581

Show
Ignore:
Timestamp:
04/20/07 00:48:10 (1 year ago)
Author:
mikey
Message:

allow foreign class loaders to throw the stubClassNotFoundException with correct file and line data

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/stubClassLoader.php

    r579 r581  
    5757     * constructor 
    5858     * 
    59      * @param  string  $fqClassName  full qualified class name of the class that was not found 
    60      */ 
    61     public function __construct($fqClassName) 
     59     * @param  string  $fqClassName         full qualified class name of the class that was not found 
     60     * @param  bool    $foreignClassLoader  optional  true if thrown in stubForeignClassLoader instance 
     61     */ 
     62    public function __construct($fqClassName, $foreignClassLoader = false) 
    6263    { 
    6364        $this->fqClassName = $fqClassName; 
    6465        $caller  = debug_backtrace(); 
    65         $message = 'The class ' . $this->fqClassName . ' loaded in ' . $caller[1]['file'] . ' on line ' . $caller[1]['line'] . ' was not found.'; 
     66        $file   = ((false == $foreignClassLoader) ? ($caller[1]['file']) : ($caller[2]['file'])); 
     67        $line   = ((false == $foreignClassLoader) ? ($caller[1]['line']) : ($caller[2]['line'])); 
     68        $message = 'The class ' . $this->fqClassName . ' loaded in ' . $file . ' on line ' . $line . ' was not found.'; 
    6669        parent::__construct($message); 
    6770    }