@@ -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