Skip to content

Commit 4dc17dc

Browse files
author
Fredrick Peter
committed
Added Error reporting - Disability
1 parent 502d728 commit 4dc17dc

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

src/Schema/OrmDotEnv.php

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,15 @@ static public function error_logger()
181181
E_USER_DEPRECATED => 'User Deprecated',
182182
);
183183

184+
// If APP_DEBUG = false
185+
// Turn off error reporsting for the application
186+
if(!self::is_debug()){
187+
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT);
188+
ini_set('display_errors', 0);
189+
}
190+
184191
// if true
185-
if(self::is_production()){
192+
if(self::is_local()){
186193
// Define the error handler function
187194
$error_handler = function($errno, $errstr, $errfile, $errline) use ($filename, $append, $max_size, $log_format, $error_levels) {
188195
// Construct the log message
@@ -267,13 +274,24 @@ static public function updateENV(?string $key = null, string|bool $value = null,
267274
}
268275

269276
/**
270-
* Determines if the application is running in production environment.
277+
* GET Application debug
271278
*
272-
* @return bool Returns true if the application is running in production environment, false otherwise.
279+
* @return bool
273280
*/
274-
static private function is_production() {
281+
static private function is_debug()
282+
{
283+
return Manager::setEnvBool(app_config('APP_DEBUG'));
284+
}
285+
286+
/**
287+
* Determines if the application is running in local environment.
288+
*
289+
* @return bool Returns true if the application is running in local environment, false otherwise.
290+
*/
291+
static private function is_local()
292+
{
275293
// check using default setting
276-
if(Manager::setEnvBool(app_config('APP_DEBUG')) && app_config('APP_ENV') == 'local'){
294+
if(self::is_debug() && app_config('APP_ENV') == 'local'){
277295
return true;
278296
}
279297

0 commit comments

Comments
 (0)