private function setTemplateSource()
    {
        // not accurate, but better than null
        $this->srcFile = $this->file;
        $this->srcLine = $this->line;

        list($file,$line) = $this->findFileAndLine();

        if (NULL === $file) {
            return false;
        }

        // this is not accurate yet, hopefully will be overwritten later
        $this->srcFile = $file;
        $this->srcLine = $line;

        $lines = @file($file);
        if (!$lines) {
            return false;
        }

        $found_line=false;
        $found_file=false;

        // scan lines backwards looking for "from line" comments
        $end = min(count($lines), $line)-1;
        for($i=$end; $i >= 0; $i--) {
            if (preg_match('/tag "[^"]*" from line (\d+)/', $lines[$i], $m)) {
                $this->srcLine = intval($m[1]);
                $found_line=true;
                break;
            }
        }

        foreach(preg_grep('/Generated by PHPTAL from/',$lines) as $line) {
            if (preg_match('/Generated by PHPTAL from (.*) \(/', $line, $m)) {
                $this->srcFile = $m[1];
                $found_file=true;
                break;
            }
        }

        return $found_line && $found_file;
    }
private function setTemplateSource()
    {
        // not accurate, but better than null
        $this->srcFile = $this->file;
        $this->srcLine = $this->line;

        list($file,$line) = $this->findFileAndLine();

        if (NULL === $file) {
            return false;
        }

        // this is not accurate yet, hopefully will be overwritten later
        $this->srcFile = $file;
        $this->srcLine = $line;

        $lines = @file($file);
        if (!$lines) {
            return false;
        }

        $found_line=false;
        $found_file=false;

        // scan lines backwards looking for "from line" comments
        $end = min(count($lines), $line)-1;
        for($i=$end; $i >= 0; $i--) {
            if (preg_match('/tag "[^"]*" from line (\d+)/', $lines[$i], $m)) {
                $this->srcLine = intval($m[1]);
                $found_line=true;
                break;
            }
        }

        foreach(preg_grep('/Generated by PHPTAL from/',$lines) as $line) {
            if (preg_match('/Generated by PHPTAL from (.*) \(/', $line, $m)) {
                $this->srcFile = $m[1];
                $found_file=true;
                break;
            }
        }

        return $found_line && $found_file;
    }
private function setTemplateSource ( ) { // not accurate, but better than null $ this -> srcFile = $ this -> file ; $ this -> srcLine = $ this -> line ; list ( $ file , $ line ) = $ this -> findFileAndLine ( ) ; if ( NULL === $ file ) { return false ; } // this is not accurate yet, hopefully will be overwritten later $ this -> srcFile = $ file ; $ this -> srcLine = $ line ; $ lines = @ file ( $ file ) ; if ( ! $ lines ) { return false ; } $ found_line = false ; $ found_file = false ; // scan lines backwards looking for "from line" comments $ end = min ( count ( $ lines ) , $ line ) - 1 ; for ( $ i = $ end ; $ i >= 0 ; $ i -- ) { if ( preg_match ( '/tag "[^"]*" from line (\d+)/' , $ lines [ $ i ] , $ m ) ) { $ this -> srcLine = intval ( $ m [ 1 ] ) ; $ found_line = true ; break ; } } foreach ( preg_grep ( '/Generated by PHPTAL from/' , $ lines ) as $ line ) { if ( preg_match ( '/Generated by PHPTAL from (.*) \(/' , $ line , $ m ) ) { $ this -> srcFile = $ m [ 1 ] ; $ found_file = true ; break ; } } return $ found_line && $ found_file ; }
sets srcLine and srcFile to template path and source line
by checking error backtrace and scanning PHP code file

@return bool true if found accurate data
sets srcLine and srcFile to template path and source line by checking error backtrace and scanning PHP code file