@@ -1,54 +1,54 @@ |
||
1 | 1 | <?php |
2 | 2 | // requireComponent("../functions/array.php"); |
3 | 3 | class Debug { |
4 | - public static $stack; |
|
5 | - private static $initialized = false; |
|
6 | - private function __construct() {} |
|
7 | - private static function initialize() { |
|
8 | - if (self::$initialized) |
|
9 | - return; |
|
10 | - self::$stack = []; |
|
11 | - self::$initialized = true; |
|
12 | - } |
|
13 | - private static function out( $_object ) { |
|
14 | - if(is_object($_object)) { |
|
15 | - echo "isObject"; |
|
16 | - } else if(is_array($_object)) { |
|
17 | - arrayDump($_object, "Debug"); |
|
18 | - } else { |
|
19 | - echo $_object; |
|
20 | - } |
|
21 | - } |
|
22 | - public static function log( $_object ) { |
|
23 | - self::out(["error" => $_object]); |
|
24 | - } |
|
25 | - public static function logln( $_object ) { |
|
26 | - self::log($_object); |
|
27 | - self::out("<br>"); |
|
28 | - } |
|
29 | - public static function logStack( $_object ) { |
|
30 | - self::out([ |
|
31 | - "position" => self::$stack, |
|
32 | - "error" => $_object |
|
33 | - ]); |
|
34 | - self::out("<br>"); |
|
35 | - } |
|
36 | - public static function push() { |
|
37 | - $debugInfo = debug_backtrace(); |
|
38 | - $debugInfo = [ |
|
39 | - "file" => $debugInfo[1]["file"], |
|
40 | - "line" => $debugInfo[1]["line"], |
|
41 | - "function" => $debugInfo[1]["function"], |
|
42 | - "class" => $debugInfo[1]["class"] |
|
43 | - ]; |
|
44 | - self::$stack[] = $debugInfo; |
|
45 | - } |
|
46 | - public static function pop() { |
|
47 | - if(count(self::$stack)>0) |
|
48 | - array_shift(self::$stack); |
|
49 | - } |
|
50 | - public static function emptyStack() { |
|
51 | - self::$stack = []; |
|
52 | - } |
|
4 | + public static $stack; |
|
5 | + private static $initialized = false; |
|
6 | + private function __construct() {} |
|
7 | + private static function initialize() { |
|
8 | + if (self::$initialized) |
|
9 | + return; |
|
10 | + self::$stack = []; |
|
11 | + self::$initialized = true; |
|
12 | + } |
|
13 | + private static function out( $_object ) { |
|
14 | + if(is_object($_object)) { |
|
15 | + echo "isObject"; |
|
16 | + } else if(is_array($_object)) { |
|
17 | + arrayDump($_object, "Debug"); |
|
18 | + } else { |
|
19 | + echo $_object; |
|
20 | + } |
|
21 | + } |
|
22 | + public static function log( $_object ) { |
|
23 | + self::out(["error" => $_object]); |
|
24 | + } |
|
25 | + public static function logln( $_object ) { |
|
26 | + self::log($_object); |
|
27 | + self::out("<br>"); |
|
28 | + } |
|
29 | + public static function logStack( $_object ) { |
|
30 | + self::out([ |
|
31 | + "position" => self::$stack, |
|
32 | + "error" => $_object |
|
33 | + ]); |
|
34 | + self::out("<br>"); |
|
35 | + } |
|
36 | + public static function push() { |
|
37 | + $debugInfo = debug_backtrace(); |
|
38 | + $debugInfo = [ |
|
39 | + "file" => $debugInfo[1]["file"], |
|
40 | + "line" => $debugInfo[1]["line"], |
|
41 | + "function" => $debugInfo[1]["function"], |
|
42 | + "class" => $debugInfo[1]["class"] |
|
43 | + ]; |
|
44 | + self::$stack[] = $debugInfo; |
|
45 | + } |
|
46 | + public static function pop() { |
|
47 | + if(count(self::$stack)>0) |
|
48 | + array_shift(self::$stack); |
|
49 | + } |
|
50 | + public static function emptyStack() { |
|
51 | + self::$stack = []; |
|
52 | + } |
|
53 | 53 | } |
54 | 54 | ?> |
@@ -10,23 +10,23 @@ discard block |
||
10 | 10 | self::$stack = []; |
11 | 11 | self::$initialized = true; |
12 | 12 | } |
13 | - private static function out( $_object ) { |
|
14 | - if(is_object($_object)) { |
|
13 | + private static function out($_object) { |
|
14 | + if (is_object($_object)) { |
|
15 | 15 | echo "isObject"; |
16 | - } else if(is_array($_object)) { |
|
16 | + } else if (is_array($_object)) { |
|
17 | 17 | arrayDump($_object, "Debug"); |
18 | 18 | } else { |
19 | 19 | echo $_object; |
20 | 20 | } |
21 | 21 | } |
22 | - public static function log( $_object ) { |
|
22 | + public static function log($_object) { |
|
23 | 23 | self::out(["error" => $_object]); |
24 | 24 | } |
25 | - public static function logln( $_object ) { |
|
25 | + public static function logln($_object) { |
|
26 | 26 | self::log($_object); |
27 | 27 | self::out("<br>"); |
28 | 28 | } |
29 | - public static function logStack( $_object ) { |
|
29 | + public static function logStack($_object) { |
|
30 | 30 | self::out([ |
31 | 31 | "position" => self::$stack, |
32 | 32 | "error" => $_object |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | self::$stack[] = $debugInfo; |
45 | 45 | } |
46 | 46 | public static function pop() { |
47 | - if(count(self::$stack)>0) |
|
47 | + if (count(self::$stack) > 0) |
|
48 | 48 | array_shift(self::$stack); |
49 | 49 | } |
50 | 50 | public static function emptyStack() { |
@@ -5,8 +5,9 @@ discard block |
||
5 | 5 | private static $initialized = false; |
6 | 6 | private function __construct() {} |
7 | 7 | private static function initialize() { |
8 | - if (self::$initialized) |
|
9 | - return; |
|
8 | + if (self::$initialized) { |
|
9 | + return; |
|
10 | + } |
|
10 | 11 | self::$stack = []; |
11 | 12 | self::$initialized = true; |
12 | 13 | } |
@@ -44,8 +45,9 @@ discard block |
||
44 | 45 | self::$stack[] = $debugInfo; |
45 | 46 | } |
46 | 47 | public static function pop() { |
47 | - if(count(self::$stack)>0) |
|
48 | - array_shift(self::$stack); |
|
48 | + if(count(self::$stack)>0) { |
|
49 | + array_shift(self::$stack); |
|
50 | + } |
|
49 | 51 | } |
50 | 52 | public static function emptyStack() { |
51 | 53 | self::$stack = []; |