<commit_before><?php

/*
 * This file is part of the 'org.octris.core' package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace org\octris\core {
    /**
     * Error class.
     * 
     * @octdoc      c:core/error
     * @copyright   Copyright (c) 2014 by <NAME>
     * @author      <NAME> <<EMAIL>>
     */
    class error
    /**/
    {
        /**
         * PHP error type to logger type mapping.
         *
         * @octdoc  p:error/$map
         * @type    array
         */
        protected static $map = array(
            E_ERROR             => \org\octris\core\logger::T_ERROR,
            E_WARNING           => \org\octris\core\logger::T_WARNING,
            E_PARSE             => \org\octris\core\logger::T_ERROR,
            E_NOTICE            => \org\octris\core\logger::T_NOTICE,
            E_CORE_ERROR        => \org\octris\core\logger::T_ERROR,
            E_CORE_WARNING      => \org\octris\core\logger::T_WARNING,
            E_COMPILE_ERROR     => \org\octris\core\logger::T_ERROR,
            E_COMPILE_WARNING   => \org\octris\core\logger::T_WARNING,
            E_USER_ERROR        => \org\octris\core\logger::T_ERROR,
            E_USER_WARNING      => \org\octris\core\logger::T_WARNING,
            E_USER_NOTICE       => \org\octris\core\logger::T_NOTICE,
            E_STRICT            => \org\octris\core\logger::T_ERROR,
            E_RECOVERABLE_ERROR => \org\octris\core\logger::T_ERROR,
            E_DEPRECATED        => \org\octris\core\logger::T_WARNING,
            E_USER_DEPRECATED   => \org\octris\core\logger::T_WARNING,
            E_ALL               => \org\octris\core\logger::T_ALL
        );
        /**/
        
        /**
         * Instance of a logger.
         *
         * @octdoc  p:error/$logger
         * @type    \org\octris\core\logger
         */
        private static $logger = null;
        /**/

        /**
         * Configure a logger instance to write error output to (instead of throwing an error exception by default).
         *
         * @octdoc  m:error/setLogger
         * @param   \org\octris\core\logger     $logger         Logger instance.
         */
        public static function setLogger(\org\octris\core\logger $logger)
        /**/
        {
            self::$logger = $logger;
        }
        
        /**
         * Error handler.
         *
         * @octdoc  m:error/errorHandler
         */
        public static function errorHandler($code, $msg, $file, $line)
        /**/
        {
            
        }
    }

    // register error handler
    set_error_handler(function($code, $msg, $file, $line) {
        \org\octris\core\error::errorHandler($code, $msg, $file, $line);
    }, E_ALL);
}
<commit_msg>throw an exception for all handled errors for the moment<commit_after><?php

/*
 * This file is part of the 'org.octris.core' package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace org\octris\core {
    /**
     * Error class.
     * 
     * @octdoc      c:core/error
     * @copyright   Copyright (c) 2014 by <NAME>
     * @author      <NAME> <<EMAIL>>
     */
    class error
    /**/
    {
        /**
         * PHP error type to logger type mapping.
         *
         * @octdoc  p:error/$map
         * @type    array
         */
        protected static $map = array(
            E_ERROR             => \org\octris\core\logger::T_ERROR,
            E_WARNING           => \org\octris\core\logger::T_WARNING,
            E_PARSE             => \org\octris\core\logger::T_ERROR,
            E_NOTICE            => \org\octris\core\logger::T_NOTICE,
            E_CORE_ERROR        => \org\octris\core\logger::T_ERROR,
            E_CORE_WARNING      => \org\octris\core\logger::T_WARNING,
            E_COMPILE_ERROR     => \org\octris\core\logger::T_ERROR,
            E_COMPILE_WARNING   => \org\octris\core\logger::T_WARNING,
            E_USER_ERROR        => \org\octris\core\logger::T_ERROR,
            E_USER_WARNING      => \org\octris\core\logger::T_WARNING,
            E_USER_NOTICE       => \org\octris\core\logger::T_NOTICE,
            E_STRICT            => \org\octris\core\logger::T_ERROR,
            E_RECOVERABLE_ERROR => \org\octris\core\logger::T_ERROR,
            E_DEPRECATED        => \org\octris\core\logger::T_WARNING,
            E_USER_DEPRECATED   => \org\octris\core\logger::T_WARNING,
            E_ALL               => \org\octris\core\logger::T_ALL
        );
        /**/
        
        /**
         * Instance of a logger.
         *
         * @octdoc  p:error/$logger
         * @type    \org\octris\core\logger
         */
        private static $logger = null;
        /**/

        /**
         * Configure a logger instance to write error output to (instead of throwing an error exception by default).
         *
         * @octdoc  m:error/setLogger
         * @param   \org\octris\core\logger     $logger         Logger instance.
         */
        public static function setLogger(\org\octris\core\logger $logger)
        /**/
        {
            self::$logger = $logger;
        }
        
        /**
         * Error handler.
         *
         * @octdoc  m:error/errorHandler
         */
        public static function errorHandler($code, $msg, $file, $line)
        /**/
        {
            throw new \ErrorException($msg, $code, 0, $file, $line);        
        }
    }

    // register error handler
    set_error_handler(function($code, $msg, $file, $line) {
        \org\octris\core\error::errorHandler($code, $msg, $file, $line);
    }, E_ALL);
}

{'fraction_non_alphanumeric': 0.1265779007435587, 'fraction_numerical': 0.0015562856648798202, 'mean_word_length': 1.5290773939658941, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 49, 'https://': 0, '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': '4471397', 'n_tokens_mistral': 1777, 'n_tokens_neox': 1767, 'n_words': 338}