Passed
Push — main ( dea438...c342a3 )
by Sammy
01:28
created
LogLaddy.php 1 patch
Braces   +20 added lines, -16 removed lines patch added patch discarded remove patch
@@ -57,12 +57,13 @@  discard block
 block discarded – undo
57 57
     $context['trace'] = $throwable->getTrace();
58 58
 
59 59
     $lad = new LogLaddy();
60
-    if(is_subclass_of($throwable, 'Error') || get_class($throwable) === 'Error')
61
-      $lad->alert(self::INTERNAL_ERROR, $context);
62
-    elseif(is_subclass_of($throwable, 'Exception') || get_class($throwable) === 'Exception')
63
-      $lad->notice(self::USER_EXCEPTION, $context);
64
-    else
65
-      $lad->critical('Caught a Throwable that is not an Error or an Exception. This breaks everything.', $context);
60
+    if(is_subclass_of($throwable, 'Error') || get_class($throwable) === 'Error') {
61
+          $lad->alert(self::INTERNAL_ERROR, $context);
62
+    } elseif(is_subclass_of($throwable, 'Exception') || get_class($throwable) === 'Exception') {
63
+          $lad->notice(self::USER_EXCEPTION, $context);
64
+    } else {
65
+          $lad->critical('Caught a Throwable that is not an Error or an Exception. This breaks everything.', $context);
66
+    }
66 67
   }
67 68
 
68 69
   public function system_halted($level)
@@ -92,15 +93,15 @@  discard block
 block discarded – undo
92 93
       error_log($display_error);
93 94
       $display_error.= self::format_trace($context['trace'], false);
94 95
       self::HTTP_500($display_error);
95
-    }
96
-    elseif($this->system_halted($level)) // analyses error level
96
+    } elseif($this->system_halted($level)) {
97
+      // analyses error level
97 98
     {
98 99
       $display_error = sprintf(PHP_EOL.'%s in file %s:%d'.PHP_EOL.'%s', $level, self::format_file($context['file']), $context['line'], $message);
100
+    }
99 101
       error_log($display_error);
100 102
       $display_error.= self::format_trace($context['trace'], true);
101 103
       self::HTTP_500($display_error);
102
-    }
103
-    else
104
+    } else
104 105
     {// --- Handles user messages, through SESSION storage
105 106
       $this->report_to_user($level, $message, $context);
106 107
     }
@@ -124,11 +125,13 @@  discard block
 block discarded – undo
124 125
   // -- User messages:add one
125 126
   public function report_to_user($level, $message, $context = [])
126 127
   {
127
-    if(!isset($_SESSION[self::REPORTING_USER]))
128
-      $_SESSION[self::REPORTING_USER] = [];
128
+    if(!isset($_SESSION[self::REPORTING_USER])) {
129
+          $_SESSION[self::REPORTING_USER] = [];
130
+    }
129 131
 
130
-    if(!isset($_SESSION[self::REPORTING_USER][$level]))
131
-      $_SESSION[self::REPORTING_USER][$level] = [];
132
+    if(!isset($_SESSION[self::REPORTING_USER][$level])) {
133
+          $_SESSION[self::REPORTING_USER][$level] = [];
134
+    }
132 135
 
133 136
     $_SESSION[self::REPORTING_USER][$level][] = [$message, $context];
134 137
   }
@@ -173,8 +176,9 @@  discard block
 block discarded – undo
173 176
     $m[E_STRICT]=$m[E_DEPRECATED]=$m[E_USER_DEPRECATED]=$m[E_ALL]=LogLevel::DEBUG;
174 177
     $m[2048]=$m[8192]=$m[16384]=$m[32767]=LogLevel::DEBUG;
175 178
 
176
-    if(isset($m[$level]))
177
-      return $m[$level];
179
+    if(isset($m[$level])) {
180
+          return $m[$level];
181
+    }
178 182
 
179 183
     throw new \Exception(__FUNCTION__."($level): $level is unknown");
180 184
   }
Please login to merge, or discard this patch.