@@ -223,17 +223,17 @@ |
||
223 | 223 | |
224 | 224 | $properties = []; |
225 | 225 | |
226 | - foreach( $class->getProperties() as $property ) { |
|
227 | - $properties[$property->getName()] = $property; |
|
228 | - } |
|
226 | + foreach( $class->getProperties() as $property ) { |
|
227 | + $properties[$property->getName()] = $property; |
|
228 | + } |
|
229 | 229 | |
230 | - if( $parent = $class->getParentClass() ) { |
|
231 | - $parent_props = static::getClassProperties($parent); |
|
232 | - if(count($parent_props) > 0) |
|
233 | - $properties = array_merge($parent_props, $properties); |
|
234 | - } |
|
230 | + if( $parent = $class->getParentClass() ) { |
|
231 | + $parent_props = static::getClassProperties($parent); |
|
232 | + if(count($parent_props) > 0) |
|
233 | + $properties = array_merge($parent_props, $properties); |
|
234 | + } |
|
235 | 235 | |
236 | - return $properties; |
|
236 | + return $properties; |
|
237 | 237 | |
238 | 238 | } |
239 | 239 |
@@ -23,33 +23,33 @@ discard block |
||
23 | 23 | return 'null'; |
24 | 24 | } |
25 | 25 | |
26 | - public static function dumpBoolean( $var ) { |
|
26 | + public static function dumpBoolean($var) { |
|
27 | 27 | return sprintf('bool(%s)', $var ? 'true' : 'false'); |
28 | 28 | } |
29 | 29 | |
30 | - public static function dumpInteger( $var ) { |
|
30 | + public static function dumpInteger($var) { |
|
31 | 31 | return "int({$var})"; |
32 | 32 | } |
33 | 33 | |
34 | - public static function dumpFloat( $var ) { |
|
34 | + public static function dumpFloat($var) { |
|
35 | 35 | return "float({$var})"; |
36 | 36 | } |
37 | 37 | |
38 | - public static function dumpString( $str ) { |
|
38 | + public static function dumpString($str) { |
|
39 | 39 | $enc = mb_detect_encoding($str, ['UTF-8', 'WINDOWS-1252', 'ISO-8859-1', 'ASCII'], true); |
40 | 40 | $enc = ($enc == 'ASCII') ? '' : "; $enc"; |
41 | 41 | return sprintf('string(%d%s) "%s"', strlen($str), $enc, $str); |
42 | 42 | } |
43 | 43 | |
44 | - public static function dumpArray( array $arr ) { |
|
44 | + public static function dumpArray(array $arr) { |
|
45 | 45 | |
46 | 46 | static::$depth++; |
47 | 47 | |
48 | 48 | $item = sprintf("array(%d) {\n", count($arr)); |
49 | - foreach( $arr as $k => $v ) { |
|
49 | + foreach ($arr as $k => $v) { |
|
50 | 50 | $item .= sprintf("%s[%s] => %s\n", str_repeat("\t", static::$depth), $k, static::dump($v, false)); |
51 | 51 | } |
52 | - $item .= str_repeat("\t", static::$depth - 1). "}"; |
|
52 | + $item .= str_repeat("\t", static::$depth - 1)."}"; |
|
53 | 53 | |
54 | 54 | static::$depth--; |
55 | 55 | |
@@ -57,28 +57,28 @@ discard block |
||
57 | 57 | |
58 | 58 | } |
59 | 59 | |
60 | - public static function dumpObject( $obj ) { |
|
60 | + public static function dumpObject($obj) { |
|
61 | 61 | |
62 | - if( $item = static::recursionCheck($obj) ) { |
|
62 | + if ($item = static::recursionCheck($obj)) { |
|
63 | 63 | return $item; |
64 | 64 | } |
65 | - elseif( $obj instanceof Dumpable ) { |
|
65 | + elseif ($obj instanceof Dumpable) { |
|
66 | 66 | $item = $obj->dump(get_called_class(), static::$depth + 1); |
67 | - if( $item ) |
|
67 | + if ($item) |
|
68 | 68 | return $item; |
69 | 69 | } |
70 | - elseif( $obj instanceof \Exception ) |
|
70 | + elseif ($obj instanceof \Exception) |
|
71 | 71 | return static::dumpException($obj); |
72 | 72 | |
73 | 73 | static::$stack[] = $obj; |
74 | 74 | |
75 | 75 | static::$depth++; |
76 | 76 | |
77 | - $item = get_class($obj). " {\n"; |
|
77 | + $item = get_class($obj)." {\n"; |
|
78 | 78 | |
79 | 79 | $item .= static::dumpObjectProperties($obj); |
80 | 80 | |
81 | - $item .= str_repeat("\t", static::$depth - 1). "}"; |
|
81 | + $item .= str_repeat("\t", static::$depth - 1)."}"; |
|
82 | 82 | |
83 | 83 | static::$depth--; |
84 | 84 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | } |
90 | 90 | |
91 | - public static function dumpException( \Exception $e ) { |
|
91 | + public static function dumpException(\Exception $e) { |
|
92 | 92 | |
93 | 93 | $item = get_class($e); |
94 | 94 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | 'previous' => $e->getPrevious(), |
102 | 102 | ]; |
103 | 103 | |
104 | - if( $e instanceof \ErrorException ) { |
|
104 | + if ($e instanceof \ErrorException) { |
|
105 | 105 | $lookup = [ |
106 | 106 | E_ERROR => 'ERROR', |
107 | 107 | E_WARNING => 'WARNING', |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | } |
132 | 132 | |
133 | - public static function dumpResource( $resource ) { |
|
133 | + public static function dumpResource($resource) { |
|
134 | 134 | |
135 | 135 | $type = get_resource_type($resource); |
136 | 136 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $item = sprintf("resource(%s; %s)", substr($item, strpos($item, '#')), $type); |
139 | 139 | |
140 | 140 | // try and get some additional info about the resource |
141 | - switch( $type ) { |
|
141 | + switch ($type) { |
|
142 | 142 | case 'stream': |
143 | 143 | $item .= static::dumpMeta( |
144 | 144 | stream_get_meta_data($resource) |
@@ -157,17 +157,17 @@ discard block |
||
157 | 157 | |
158 | 158 | } |
159 | 159 | |
160 | - protected static function dumpMeta( $meta ) { |
|
160 | + protected static function dumpMeta($meta) { |
|
161 | 161 | |
162 | 162 | static::$depth++; |
163 | 163 | |
164 | 164 | $width = max(array_map('strlen', array_keys($meta))) + 1; |
165 | 165 | |
166 | 166 | $item = " {\n"; |
167 | - foreach( $meta as $k => $v ) { |
|
168 | - $item .= sprintf("%s%s: %s\n", str_repeat("\t", static::$depth), str_pad(ucwords(str_replace('_', ' ', $k)), $width) , static::dump($v, false)); |
|
167 | + foreach ($meta as $k => $v) { |
|
168 | + $item .= sprintf("%s%s: %s\n", str_repeat("\t", static::$depth), str_pad(ucwords(str_replace('_', ' ', $k)), $width), static::dump($v, false)); |
|
169 | 169 | } |
170 | - $item .= str_repeat("\t", static::$depth - 1). "}"; |
|
170 | + $item .= str_repeat("\t", static::$depth - 1)."}"; |
|
171 | 171 | |
172 | 172 | static::$depth--; |
173 | 173 | |
@@ -175,23 +175,23 @@ discard block |
||
175 | 175 | |
176 | 176 | } |
177 | 177 | |
178 | - protected static function dumpTrace( array $trace ) { |
|
178 | + protected static function dumpTrace(array $trace) { |
|
179 | 179 | |
180 | 180 | $lines = []; |
181 | 181 | |
182 | - foreach( $trace as $i => $frame ) { |
|
182 | + foreach ($trace as $i => $frame) { |
|
183 | 183 | |
184 | 184 | $line = ''; |
185 | 185 | |
186 | - if( isset($frame['class']) ) |
|
187 | - $line .= $frame['class']. $frame['type']; |
|
186 | + if (isset($frame['class'])) |
|
187 | + $line .= $frame['class'].$frame['type']; |
|
188 | 188 | |
189 | - $line .= $frame['function']. '()'; |
|
189 | + $line .= $frame['function'].'()'; |
|
190 | 190 | |
191 | - if( isset($frame['file']) ) { |
|
192 | - $line .= ' ['. $frame['file']; |
|
193 | - if( isset($frame['line']) ) |
|
194 | - $line .= ':'. $frame['line']; |
|
191 | + if (isset($frame['file'])) { |
|
192 | + $line .= ' ['.$frame['file']; |
|
193 | + if (isset($frame['line'])) |
|
194 | + $line .= ':'.$frame['line']; |
|
195 | 195 | $line .= ']'; |
196 | 196 | } |
197 | 197 | |
@@ -203,14 +203,14 @@ discard block |
||
203 | 203 | |
204 | 204 | } |
205 | 205 | |
206 | - protected static function dumpObjectProperties( $obj ) { |
|
206 | + protected static function dumpObjectProperties($obj) { |
|
207 | 207 | |
208 | 208 | // we use reflection to access all the object's properties (public, protected and private) |
209 | 209 | $r = new \ReflectionObject($obj); |
210 | 210 | |
211 | 211 | $item = ''; |
212 | 212 | |
213 | - foreach( static::getClassProperties($r) as $p ) { |
|
213 | + foreach (static::getClassProperties($r) as $p) { |
|
214 | 214 | $p->setAccessible(true); |
215 | 215 | $item .= sprintf("%s%s: %s\n", str_repeat("\t", static::$depth), $p->name, static::dump($p->getValue($obj), false)); |
216 | 216 | } |
@@ -219,17 +219,17 @@ discard block |
||
219 | 219 | |
220 | 220 | } |
221 | 221 | |
222 | - protected static function getClassProperties( \ReflectionClass $class ) { |
|
222 | + protected static function getClassProperties(\ReflectionClass $class) { |
|
223 | 223 | |
224 | 224 | $properties = []; |
225 | 225 | |
226 | - foreach( $class->getProperties() as $property ) { |
|
226 | + foreach ($class->getProperties() as $property) { |
|
227 | 227 | $properties[$property->getName()] = $property; |
228 | 228 | } |
229 | 229 | |
230 | - if( $parent = $class->getParentClass() ) { |
|
230 | + if ($parent = $class->getParentClass()) { |
|
231 | 231 | $parent_props = static::getClassProperties($parent); |
232 | - if(count($parent_props) > 0) |
|
232 | + if (count($parent_props) > 0) |
|
233 | 233 | $properties = array_merge($parent_props, $properties); |
234 | 234 | } |
235 | 235 | |
@@ -237,12 +237,12 @@ discard block |
||
237 | 237 | |
238 | 238 | } |
239 | 239 | |
240 | - protected static function recursionCheck( $obj ) { |
|
240 | + protected static function recursionCheck($obj) { |
|
241 | 241 | |
242 | - if( end(static::$stack) === $obj ) |
|
242 | + if (end(static::$stack) === $obj) |
|
243 | 243 | return '**SELF**'; |
244 | 244 | |
245 | - elseif( in_array($obj, static::$stack) ) |
|
245 | + elseif (in_array($obj, static::$stack)) |
|
246 | 246 | return '**RECURSION**'; |
247 | 247 | |
248 | 248 | return ''; |
@@ -61,14 +61,14 @@ discard block |
||
61 | 61 | |
62 | 62 | if( $item = static::recursionCheck($obj) ) { |
63 | 63 | return $item; |
64 | - } |
|
65 | - elseif( $obj instanceof Dumpable ) { |
|
64 | + } elseif( $obj instanceof Dumpable ) { |
|
66 | 65 | $item = $obj->dump(get_called_class(), static::$depth + 1); |
67 | - if( $item ) |
|
68 | - return $item; |
|
66 | + if( $item ) { |
|
67 | + return $item; |
|
68 | + } |
|
69 | + } elseif( $obj instanceof \Exception ) { |
|
70 | + return static::dumpException($obj); |
|
69 | 71 | } |
70 | - elseif( $obj instanceof \Exception ) |
|
71 | - return static::dumpException($obj); |
|
72 | 72 | |
73 | 73 | static::$stack[] = $obj; |
74 | 74 | |
@@ -183,15 +183,17 @@ discard block |
||
183 | 183 | |
184 | 184 | $line = ''; |
185 | 185 | |
186 | - if( isset($frame['class']) ) |
|
187 | - $line .= $frame['class']. $frame['type']; |
|
186 | + if( isset($frame['class']) ) { |
|
187 | + $line .= $frame['class']. $frame['type']; |
|
188 | + } |
|
188 | 189 | |
189 | 190 | $line .= $frame['function']. '()'; |
190 | 191 | |
191 | 192 | if( isset($frame['file']) ) { |
192 | 193 | $line .= ' ['. $frame['file']; |
193 | - if( isset($frame['line']) ) |
|
194 | - $line .= ':'. $frame['line']; |
|
194 | + if( isset($frame['line']) ) { |
|
195 | + $line .= ':'. $frame['line']; |
|
196 | + } |
|
195 | 197 | $line .= ']'; |
196 | 198 | } |
197 | 199 | |
@@ -229,8 +231,9 @@ discard block |
||
229 | 231 | |
230 | 232 | if( $parent = $class->getParentClass() ) { |
231 | 233 | $parent_props = static::getClassProperties($parent); |
232 | - if(count($parent_props) > 0) |
|
233 | - $properties = array_merge($parent_props, $properties); |
|
234 | + if(count($parent_props) > 0) { |
|
235 | + $properties = array_merge($parent_props, $properties); |
|
236 | + } |
|
234 | 237 | } |
235 | 238 | |
236 | 239 | return $properties; |
@@ -239,11 +242,11 @@ discard block |
||
239 | 242 | |
240 | 243 | protected static function recursionCheck( $obj ) { |
241 | 244 | |
242 | - if( end(static::$stack) === $obj ) |
|
243 | - return '**SELF**'; |
|
244 | - |
|
245 | - elseif( in_array($obj, static::$stack) ) |
|
246 | - return '**RECURSION**'; |
|
245 | + if( end(static::$stack) === $obj ) { |
|
246 | + return '**SELF**'; |
|
247 | + } elseif( in_array($obj, static::$stack) ) { |
|
248 | + return '**RECURSION**'; |
|
249 | + } |
|
247 | 250 | |
248 | 251 | return ''; |
249 | 252 |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | * @param int $line |
24 | 24 | * @return void |
25 | 25 | */ |
26 | - public static function error( $severity, $message, $file, $line ) { |
|
26 | + public static function error($severity, $message, $file, $line) { |
|
27 | 27 | |
28 | 28 | // Latest Twig raises a warning when accessing missing cached views - we can ignore it |
29 | - if( preg_match('/filemtime/', $message) ) |
|
29 | + if (preg_match('/filemtime/', $message)) |
|
30 | 30 | return; |
31 | 31 | |
32 | 32 | // if the error was a type hint failure then throw an InvalidArgumentException instead |
33 | - elseif( preg_match('/^Argument (\d+) passed to ([\w\\\\]+)::(\w+)\(\) must be an instance of ([\w\\\\]+), ([\w\\\\]+) given, called in ([\w\s\.\/_-]+) on line (\d+)/', $message, $m) ) |
|
33 | + elseif (preg_match('/^Argument (\d+) passed to ([\w\\\\]+)::(\w+)\(\) must be an instance of ([\w\\\\]+), ([\w\\\\]+) given, called in ([\w\s\.\/_-]+) on line (\d+)/', $message, $m)) |
|
34 | 34 | throw new \InvalidArgumentException("Argument {$m[1]} to {$m[2]}::{$m[3]}() should be an instance of {$m[4]}, {$m[5]} given", $severity, new \ErrorException($message, 0, $severity, $m[6], $m[7])); |
35 | 35 | |
36 | 36 | // convert the error to an exception |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | * @param string $error_page the file containing the error page to include for production web apps |
45 | 45 | * @return void |
46 | 46 | */ |
47 | - public static function exception( \Exception $error, $error_page, $log = true ) { |
|
47 | + public static function exception(\Exception $error, $error_page, $log = true) { |
|
48 | 48 | |
49 | - if( $log ) |
|
49 | + if ($log) |
|
50 | 50 | static::logException($error); |
51 | 51 | |
52 | - if( Yolk::isCLI() ) { |
|
52 | + if (Yolk::isCLI()) { |
|
53 | 53 | Yolk::dump($error); |
54 | 54 | } |
55 | 55 | // debug web app |
56 | - elseif( Yolk::isDebug() ) { |
|
57 | - require __DIR__. '/error.debug.php'; |
|
56 | + elseif (Yolk::isDebug()) { |
|
57 | + require __DIR__.'/error.debug.php'; |
|
58 | 58 | } |
59 | 59 | // production web app |
60 | 60 | else { |
@@ -68,15 +68,15 @@ discard block |
||
68 | 68 | * @param \Exception $error |
69 | 69 | * @return void |
70 | 70 | */ |
71 | - public static function logException( \Exception $error ) { |
|
71 | + public static function logException(\Exception $error) { |
|
72 | 72 | |
73 | 73 | // fatal errors will already have been error_log()'d |
74 | - if( !static::isFatal($error) ) { |
|
75 | - $location = $error->getFile(). ':'. $error->getLine(); |
|
74 | + if (!static::isFatal($error)) { |
|
75 | + $location = $error->getFile().':'.$error->getLine(); |
|
76 | 76 | // type hinting error - make sure we give the correct location |
77 | - if( ($error instanceof \InvalidArgumentException) && ($error->getPrevious() instanceof \ErrorException) ) |
|
78 | - $location = $error->getPrevious()->getFile(). ':'. $error->getPrevious()->getLine(); |
|
79 | - error_log(get_class($error). ': '. $error->getMessage(). " [{$location}]"); |
|
77 | + if (($error instanceof \InvalidArgumentException) && ($error->getPrevious() instanceof \ErrorException)) |
|
78 | + $location = $error->getPrevious()->getFile().':'.$error->getPrevious()->getLine(); |
|
79 | + error_log(get_class($error).': '.$error->getMessage()." [{$location}]"); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public static function checkFatal() { |
89 | 89 | $error = error_get_last(); |
90 | - if( $error && static::isFatal($error['type']) ) { |
|
90 | + if ($error && static::isFatal($error['type'])) { |
|
91 | 91 | Yolk::exception(new \ErrorException($error['message'], 0, $error['type'], $error['file'], $error['line'])); |
92 | 92 | } |
93 | 93 | } |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | * @param \Exception|integer $error |
98 | 98 | * @return boolean |
99 | 99 | */ |
100 | - protected static function isFatal( $error ) { |
|
100 | + protected static function isFatal($error) { |
|
101 | 101 | |
102 | - if( $error instanceof \Exception ) |
|
102 | + if ($error instanceof \Exception) |
|
103 | 103 | return false; |
104 | 104 | |
105 | 105 | $fatal = E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR; |
106 | 106 | |
107 | - if( $error instanceof \ErrorException ) |
|
107 | + if ($error instanceof \ErrorException) |
|
108 | 108 | $error = $error->getSeverity(); |
109 | 109 | |
110 | 110 | return (bool) ($error & $fatal); |
@@ -26,12 +26,14 @@ discard block |
||
26 | 26 | public static function error( $severity, $message, $file, $line ) { |
27 | 27 | |
28 | 28 | // Latest Twig raises a warning when accessing missing cached views - we can ignore it |
29 | - if( preg_match('/filemtime/', $message) ) |
|
30 | - return; |
|
29 | + if( preg_match('/filemtime/', $message) ) { |
|
30 | + return; |
|
31 | + } |
|
31 | 32 | |
32 | 33 | // if the error was a type hint failure then throw an InvalidArgumentException instead |
33 | - elseif( preg_match('/^Argument (\d+) passed to ([\w\\\\]+)::(\w+)\(\) must be an instance of ([\w\\\\]+), ([\w\\\\]+) given, called in ([\w\s\.\/_-]+) on line (\d+)/', $message, $m) ) |
|
34 | - throw new \InvalidArgumentException("Argument {$m[1]} to {$m[2]}::{$m[3]}() should be an instance of {$m[4]}, {$m[5]} given", $severity, new \ErrorException($message, 0, $severity, $m[6], $m[7])); |
|
34 | + elseif( preg_match('/^Argument (\d+) passed to ([\w\\\\]+)::(\w+)\(\) must be an instance of ([\w\\\\]+), ([\w\\\\]+) given, called in ([\w\s\.\/_-]+) on line (\d+)/', $message, $m) ) { |
|
35 | + throw new \InvalidArgumentException("Argument {$m[1]} to {$m[2]}::{$m[3]}() should be an instance of {$m[4]}, {$m[5]} given", $severity, new \ErrorException($message, 0, $severity, $m[6], $m[7])); |
|
36 | + } |
|
35 | 37 | |
36 | 38 | // convert the error to an exception |
37 | 39 | throw new \ErrorException($message, 0, $severity, $file, $line); |
@@ -46,8 +48,9 @@ discard block |
||
46 | 48 | */ |
47 | 49 | public static function exception( \Exception $error, $error_page, $log = true ) { |
48 | 50 | |
49 | - if( $log ) |
|
50 | - static::logException($error); |
|
51 | + if( $log ) { |
|
52 | + static::logException($error); |
|
53 | + } |
|
51 | 54 | |
52 | 55 | if( Yolk::isCLI() ) { |
53 | 56 | Yolk::dump($error); |
@@ -74,8 +77,9 @@ discard block |
||
74 | 77 | if( !static::isFatal($error) ) { |
75 | 78 | $location = $error->getFile(). ':'. $error->getLine(); |
76 | 79 | // type hinting error - make sure we give the correct location |
77 | - if( ($error instanceof \InvalidArgumentException) && ($error->getPrevious() instanceof \ErrorException) ) |
|
78 | - $location = $error->getPrevious()->getFile(). ':'. $error->getPrevious()->getLine(); |
|
80 | + if( ($error instanceof \InvalidArgumentException) && ($error->getPrevious() instanceof \ErrorException) ) { |
|
81 | + $location = $error->getPrevious()->getFile(). ':'. $error->getPrevious()->getLine(); |
|
82 | + } |
|
79 | 83 | error_log(get_class($error). ': '. $error->getMessage(). " [{$location}]"); |
80 | 84 | } |
81 | 85 | |
@@ -99,13 +103,15 @@ discard block |
||
99 | 103 | */ |
100 | 104 | protected static function isFatal( $error ) { |
101 | 105 | |
102 | - if( $error instanceof \Exception ) |
|
103 | - return false; |
|
106 | + if( $error instanceof \Exception ) { |
|
107 | + return false; |
|
108 | + } |
|
104 | 109 | |
105 | 110 | $fatal = E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR; |
106 | 111 | |
107 | - if( $error instanceof \ErrorException ) |
|
108 | - $error = $error->getSeverity(); |
|
112 | + if( $error instanceof \ErrorException ) { |
|
113 | + $error = $error->getSeverity(); |
|
114 | + } |
|
109 | 115 | |
110 | 116 | return (bool) ($error & $fatal); |
111 | 117 |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | // use default php error handler |
6 | 6 | set_error_handler( |
7 | - function( $severity, $message, $file, $line ) { |
|
7 | + function($severity, $message, $file, $line) { |
|
8 | 8 | return false; |
9 | 9 | } |
10 | 10 | ); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | ]; |
30 | 30 | |
31 | 31 | $err = [ |
32 | - 'name' => '\\'. get_class($error), |
|
32 | + 'name' => '\\'.get_class($error), |
|
33 | 33 | 'code' => $error->getCode(), |
34 | 34 | 'message' => $error->getMessage(), |
35 | 35 | 'file' => $error->getFile(), |
@@ -37,16 +37,16 @@ discard block |
||
37 | 37 | 'trace' => $error->getTrace(), |
38 | 38 | 'previous' => $error->getPrevious(), |
39 | 39 | ]; |
40 | -if( $error instanceof \ErrorException ) { |
|
40 | +if ($error instanceof \ErrorException) { |
|
41 | 41 | $err['name'] = $names[$error->getSeverity()]; |
42 | 42 | } |
43 | -elseif( ($error instanceof \InvalidArgumentException) && ($err['previous'] instanceof \ErrorException) ) { |
|
43 | +elseif (($error instanceof \InvalidArgumentException) && ($err['previous'] instanceof \ErrorException)) { |
|
44 | 44 | $err['file'] = $err['previous']->getFile(); |
45 | 45 | $err['line'] = $err['previous']->getLine(); |
46 | 46 | } |
47 | 47 | |
48 | 48 | // it's an error - don't send a 200 code! |
49 | -if( !headers_sent() && (http_response_code() == 200) ) |
|
49 | +if (!headers_sent() && (http_response_code() == 200)) |
|
50 | 50 | header("HTTP/1.0 500 Internal Server Error"); |
51 | 51 | |
52 | 52 | ?><!DOCTYPE html> |
@@ -151,20 +151,20 @@ discard block |
||
151 | 151 | |
152 | 152 | </div> |
153 | 153 | |
154 | -<?php if( $err['trace'] ) { ?> |
|
154 | +<?php if ($err['trace']) { ?> |
|
155 | 155 | <div id="trace"> |
156 | 156 | <h2>Trace:</h2> |
157 | 157 | <ol> |
158 | - <?php foreach( $err['trace'] as $i => $item ) { ?> |
|
158 | + <?php foreach ($err['trace'] as $i => $item) { ?> |
|
159 | 159 | <li class="panel"> |
160 | 160 | <?php |
161 | - if( isset($item['file']) ) { ?> |
|
161 | + if (isset($item['file'])) { ?> |
|
162 | 162 | <p> |
163 | 163 | <strong>File:</strong> <code><?=$item['file']; ?></code> |
164 | - <?php if( isset($item['line']) ) { ?> <strong>Line:</strong> <code><?=$item['line'] ?></code><?php } ?> |
|
164 | + <?php if (isset($item['line'])) { ?> <strong>Line:</strong> <code><?=$item['line'] ?></code><?php } ?> |
|
165 | 165 | </p> |
166 | 166 | <?php } ?> |
167 | - <p><strong>Function: </strong><code><?=isset($item['class']) ? $item['class']. $item['type'] : ''?><?=$item['function']. '()'; ?></code></p> |
|
167 | + <p><strong>Function: </strong><code><?=isset($item['class']) ? $item['class'].$item['type'] : ''?><?=$item['function'].'()'; ?></code></p> |
|
168 | 168 | </li> |
169 | 169 | <?php } ?> |
170 | 170 | </ol> |
@@ -39,15 +39,15 @@ |
||
39 | 39 | ]; |
40 | 40 | if( $error instanceof \ErrorException ) { |
41 | 41 | $err['name'] = $names[$error->getSeverity()]; |
42 | -} |
|
43 | -elseif( ($error instanceof \InvalidArgumentException) && ($err['previous'] instanceof \ErrorException) ) { |
|
42 | +} elseif( ($error instanceof \InvalidArgumentException) && ($err['previous'] instanceof \ErrorException) ) { |
|
44 | 43 | $err['file'] = $err['previous']->getFile(); |
45 | 44 | $err['line'] = $err['previous']->getLine(); |
46 | 45 | } |
47 | 46 | |
48 | 47 | // it's an error - don't send a 200 code! |
49 | -if( !headers_sent() && (http_response_code() == 200) ) |
|
48 | +if( !headers_sent() && (http_response_code() == 200) ) { |
|
50 | 49 | header("HTTP/1.0 500 Internal Server Error"); |
50 | +} |
|
51 | 51 | |
52 | 52 | ?><!DOCTYPE html> |
53 | 53 | <html> |