<commit_before><?php

/**
 * TITLE HERE
 * 
 * @name        customErrors.php
 * @package     framework.local
 * @version     
 * @since       10-May-2017 12:03:14
 * @author      <NAME>
 * @abstract    
 */
error_reporting(E_ALL ^ (E_NOTICE | E_DEPRECATED));
include_once("autoLoader.php");

class customException extends Exception {

    public function errorMessage() {
        $this->httpError();
    }

    public function httpError($httpCode=404) {
        $httpResponse = \http\httpResponse::getCode($httpCode);
        $errorMessage = $this->message;
        $fileName = str_replace(\config\config::DIR_BASE, "", $this->file);
        $lineNumber = $this->line;
        
        if(file_exists(\config\config::DIR_TEMPLATES . "/" . \config\config::TEMPLATE . "/{$httpCode}.php")) {
            $errorPage = file_get_contents(\config\config::DIR_TEMPLATES . "/" . \config\config::TEMPLATE . "/{$httpCode}.php");
        } elseif(file_exists(\config\config::DIR_TEMPLATES . "/" . \config\config::TEMPLATE . "/error.php")) {
            $errorPage = file_get_contents(\config\config::DIR_TEMPLATES . "/" . \config\config::TEMPLATE . "/error.php");
        } else {
            $errorPage = <<<EOD
                    <link href="https://fonts.googleapis.com/css?family=Raleway:400,400i,700" rel="stylesheet">
                    <style>
                        html {font-family: "Raleway"}
                        h1 {margin: 0; padding: 0; font-szie: 1.4em; text-align: center;}
                        table {border-collapse: collapse; border: 1px solid #234; width: auto; margin: 10px auto;}<commit_msg>Added custom error trapping and some default basic classes<commit_after><?php

/**
 * CUSTOM EXCEPTION HANDLER
 * 
 * @name        customErrors.php
 * @package     framework.local
 * @version     
 * @since       10-May-2017 12:03:14
 * @author      <NAME>
 * @abstract    Trap all errors thrown from the framework   
 */
error_reporting(E_ALL ^ (E_NOTICE | E_DEPRECATED));
include_once("autoLoader.php");

class customException extends Exception {

    public function errorMessage() {
        $this->httpError();
    }

    public function httpError($httpCode=404) {
        $httpResponse = \http\httpResponse::getCode($httpCode);
        $errorMessage = $this->message;
        $fileName = str_replace(\config\config::DIR_BASE, "", $this->file);
        $lineNumber = $this->line;
        
        if(file_exists(\config\config::DIR_TEMPLATES . "/" . \config\config::TEMPLATE . "/{$httpCode}.php")) {
            $errorPage = file_get_contents(\config\config::DIR_TEMPLATES . "/" . \config\config::TEMPLATE . "/{$httpCode}.php");
        } elseif(file_exists(\config\config::DIR_TEMPLATES . "/" . \config\config::TEMPLATE . "/error.php")) {
            $errorPage = file_get_contents(\config\config::DIR_TEMPLATES . "/" . \config\config::TEMPLATE . "/error.php");
        } else {
            $errorPage = <<<EOD
                    <link href="https://fonts.googleapis.com/css?family=Raleway:400,400i,700" rel="stylesheet">
                    <style>
                        html {font-family: "Raleway"}
                        h1 {margin: 0; padding: 0; font-szie: 1.4em; text-align: center;}
                        table {border-collapse: collapse; border: 1px solid #234; width: auto; margin: 10px auto;}
{'fraction_non_alphanumeric': 0.15458646616541352, 'fraction_numerical': 0.021052631578947368, 'mean_word_length': 2.468196037539103, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, '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': '2196528', 'n_tokens_mistral': 1078, 'n_tokens_neox': 1005, 'n_words': 181}