<commit_before><?php
/**
 * Hendle every runtime code execution errors.
 *
 * @author	<NAME> <<EMAIL>>
 * @link	http://panadaframework.com/
 * @license	http://www.opensource.org/licenses/bsd-license.php
 * @since	version 1.0.0
 * @package	Resources
 */
namespace Resources;

class RunException extends \Exception
{    
    public function __construct($message = null, $code = 0, Exception $previous = null)
    {
        parent::__construct($message, $code, $previous);
    }
    
    public function __toString()
    {    
        return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
    }
    
    public static function main($exception)
    {    
        $message = $exception->getMessage();
        $file = false;
        $line = false;
        $traceAsString = $exception->getTraceAsString();
        
	foreach ($exception->getTrace() as $trace) {
	    if (isset($trace['file'])) {
		$file = $trace['file'];
		if (isset($trace['line'])) {
		    $line = $trace['line'];
		}
		break;
	    }
	}
	
        self::outputError($message, $file, $line, $traceAsString);
    }
    
    public static function errorHandlerCallback($errno, $message, $file, $line)
    {    
        if($errno == E_WARNING)
            return;
        
        self::outputError($message, $file, $line);
    }
    
    public static function outputError($message = null, $file = false, $line = false, $trace = false)
    {    
        // Message for log
        $errorMessage = 'Error '.$message.' in '.$file . ' line: ' . $line;
        
        // Write the error to log file
	@error_log($errorMessage);
        
        // Just output the error if the error source for view file or if in cli mode.
        if( (array_search( 'views', explode('/', $file) ) !== false) || (PHP_SAPI == 'cli') ){
            exit($errorMessage);
        }
        
        $code = array();
        
        if( ! $file )
            goto constructViewData;<commit_msg>Fix read error flag type<commit_after><?php
/**
 * Hendle every runtime code execution errors.
 *
 * @author	<NAME> <<EMAIL>>
 * @link	http://panadaframework.com/
 * @license	http://www.opensource.org/licenses/bsd-license.php
 * @since	version 1.0.0
 * @package	Resources
 */
namespace Resources;

class RunException extends \Exception
{    
    public function __construct($message = null, $code = 0, Exception $previous = null)
    {
        parent::__construct($message, $code, $previous);
    }
    
    public function __toString()
    {    
        return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
    }
    
    public static function main($exception)
    {    
        $message = $exception->getMessage();
        $file = false;
        $line = false;
        $traceAsString = $exception->getTraceAsString();
        
	foreach ($exception->getTrace() as $trace) {
	    if (isset($trace['file'])) {
		$file = $trace['file'];
		if (isset($trace['line'])) {
		    $line = $trace['line'];
		}
		break;
	    }
	}
	
        self::outputError($message, $file, $line, $traceAsString);
    }
    
    public static function errorHandlerCallback($errno, $message, $file, $line)
    {    
        if ( ! (error_reporting() & $errno) )
	    return;
        
        self::outputError($message, $file, $line);
    }
    
    public static function outputError($message = null, $file = false, $line = false, $trace = false)
    {    
        // Message for log
        $errorMessage = 'Error '.$message.' in '.$file . ' line: ' . $line;
        
        // Write the error to log file
	@error_log($errorMessage);
        
        // Just output the error if the error source for view file or if in cli mode.
        if( (array_search( 'views', explode('/', $file) ) !== false) || (PHP_SAPI == 'cli') ){
            exit($errorMessage);
        }
        
        $code = array();
        
        if( ! $file )
            goto constructViewData;
{'fraction_non_alphanumeric': 0.1529351184346035, 'fraction_numerical': 0.0020597322348094747, 'mean_word_length': 2.2321131447587352, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1862954', 'n_tokens_mistral': 1176, 'n_tokens_neox': 1150, 'n_words': 294}