public static function error(int $code, string $message, string $file, int $line) : bool
    {
        // If isset error_reporting and $code then throw new error exception
        if ((error_reporting() & $code) !== 0) {

            /**
             * Dont thow NOTICE exception for PRODUCTION Environment. Just write to log.
             */
            if (DEVELOPMENT == false && $code == 8) {

                // Get exception info
                $error['code']    = $code;
                $error['message'] = $message;
                $error['file']    = $file;
                $error['line']    = $line;
                $error['type']    = 'ErrorException: ';

                $codes = array (
                    E_USER_NOTICE       => 'Notice',
                );

                $error['type'] .= in_array($error['code'], array_keys($codes)) ? $codes[$error['code']] : 'Unknown Error';

                // Write to log
                ErrorHandler::writeLogs("{$error['type']}: {$error['message']} in {$error['file']} at line {$error['line']}");

            } else {
                throw new \ErrorException($message, $code, 0, $file, $line);
            }
        }

        // Don't execute PHP internal error handler
        return true;
    }
public static function error(int $code, string $message, string $file, int $line) : bool
    {
        // If isset error_reporting and $code then throw new error exception
        if ((error_reporting() & $code) !== 0) {

            /**
             * Dont thow NOTICE exception for PRODUCTION Environment. Just write to log.
             */
            if (DEVELOPMENT == false && $code == 8) {

                // Get exception info
                $error['code']    = $code;
                $error['message'] = $message;
                $error['file']    = $file;
                $error['line']    = $line;
                $error['type']    = 'ErrorException: ';

                $codes = array (
                    E_USER_NOTICE       => 'Notice',
                );

                $error['type'] .= in_array($error['code'], array_keys($codes)) ? $codes[$error['code']] : 'Unknown Error';

                // Write to log
                ErrorHandler::writeLogs("{$error['type']}: {$error['message']} in {$error['file']} at line {$error['line']}");

            } else {
                throw new \ErrorException($message, $code, 0, $file, $line);
            }
        }

        // Don't execute PHP internal error handler
        return true;
    }
public static function error ( int $ code , string $ message , string $ file , int $ line ) : bool { // If isset error_reporting and $code then throw new error exception if ( ( error_reporting ( ) & $ code ) !== 0 ) { /**
             * Dont thow NOTICE exception for PRODUCTION Environment. Just write to log.
             */ if ( DEVELOPMENT == false && $ code == 8 ) { // Get exception info $ error [ 'code' ] = $ code ; $ error [ 'message' ] = $ message ; $ error [ 'file' ] = $ file ; $ error [ 'line' ] = $ line ; $ error [ 'type' ] = 'ErrorException: ' ; $ codes = array ( E_USER_NOTICE => 'Notice' , ) ; $ error [ 'type' ] .= in_array ( $ error [ 'code' ] , array_keys ( $ codes ) ) ? $ codes [ $ error [ 'code' ] ] : 'Unknown Error' ; // Write to log ErrorHandler :: writeLogs ( "{$error['type']}: {$error['message']} in {$error['file']} at line {$error['line']}" ) ; } else { throw new \ ErrorException ( $ message , $ code , 0 , $ file , $ line ) ; } } // Don't execute PHP internal error handler return true ; }
Converts errors to ErrorExceptions.

@param  int     $code    The error code
@param  string  $message The error message
@param  string  $file    The filename where the error occurred
@param  int     $line    The line number where the error occurred
@return bool
Converts errors to ErrorExceptions .