@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | case 'string' : $length = strlen($var); $var = '\'' . htmlentities($var) . '\''; break; |
110 | 110 | case 'NULL' : return '<span class="empty">NULL</span>'; break; |
111 | 111 | } |
112 | - $ret = '<span class="value ' . $type .'">' . $var . '</span> '; |
|
112 | + $ret = '<span class="value ' . $type .'">' . $var . '</span> '; |
|
113 | 113 | |
114 | - if ($type == 'string') { |
|
115 | - $ret .= '<span class="type">string[' . $length . ']</span>'; |
|
116 | - } else { |
|
117 | - $ret .= '<span class="type">' . $type . '</span>'; |
|
118 | - } |
|
114 | + if ($type == 'string') { |
|
115 | + $ret .= '<span class="type">string[' . $length . ']</span>'; |
|
116 | + } else { |
|
117 | + $ret .= '<span class="type">' . $type . '</span>'; |
|
118 | + } |
|
119 | 119 | return $ret; |
120 | 120 | } |
121 | 121 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | { |
124 | 124 | extract($location); |
125 | 125 | $ret = "line: <span>$line</span> ". |
126 | - "file: <span>$file</span> "; |
|
126 | + "file: <span>$file</span> "; |
|
127 | 127 | $ret .= isset($class) ? "class: <span>$class</span> " :''; |
128 | 128 | $ret .= isset($function) && $function != 'include' ? "function: <span>$function</span> " :''; |
129 | 129 | return $ret; |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | public $options; |
28 | 28 | public $output = array('<style type="text/css">@import url("/css/debug.css");</style>'); |
29 | 29 | |
30 | - /** |
|
31 | - * Get the singleton instance |
|
32 | - * |
|
33 | - * @return alkemann\hl\debug\util\Debug |
|
34 | - */ |
|
30 | + /** |
|
31 | + * Get the singleton instance |
|
32 | + * |
|
33 | + * @return alkemann\hl\debug\util\Debug |
|
34 | + */ |
|
35 | 35 | public static function get_instance() : Debug |
36 | 36 | { |
37 | 37 | if (!static::$__instance) { |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | return static::$__instance; |
42 | 42 | } |
43 | 43 | |
44 | - /** |
|
45 | - * Dump |
|
46 | - * |
|
47 | - * @param mixed $var |
|
48 | - * @param array $options |
|
49 | - */ |
|
44 | + /** |
|
45 | + * Dump |
|
46 | + * |
|
47 | + * @param mixed $var |
|
48 | + * @param array $options |
|
49 | + */ |
|
50 | 50 | public function dump($var, $options = array()) : void |
51 | 51 | { |
52 | 52 | $options += self::$defaults + array('split' => false, 'trace' => false); |
@@ -62,76 +62,76 @@ discard block |
||
62 | 62 | if ($options['split'] && is_array($var)) { |
63 | 63 | $this->current_depth = 0; |
64 | 64 | foreach ($var as $one) { |
65 | - $dump = array_merge($dump, array($this->dump_it($one), ' - ')); |
|
66 | - } |
|
67 | - $dump = array_slice($dump, 0, -1); |
|
65 | + $dump = array_merge($dump, array($this->dump_it($one), ' - ')); |
|
66 | + } |
|
67 | + $dump = array_slice($dump, 0, -1); |
|
68 | 68 | } else |
69 | 69 | $dump[] = $this->dump_it($var); |
70 | 70 | |
71 | 71 | switch ($mode) { |
72 | - default : |
|
73 | - $locString = \alkemann\h2l\internals\debug\adapters\Html::locationString($location); |
|
74 | - $this->output[] = '<div class="debug-dump"><div class="debug-location">' . $locString . '</div>'. |
|
75 | - '<div class="debug-content"> ' . implode("<br>\n", $dump) . '</div></div>'; |
|
76 | - break; |
|
77 | - } |
|
78 | - if ($options['echo']) { |
|
79 | - $this->__out(); |
|
80 | - } |
|
72 | + default : |
|
73 | + $locString = \alkemann\h2l\internals\debug\adapters\Html::locationString($location); |
|
74 | + $this->output[] = '<div class="debug-dump"><div class="debug-location">' . $locString . '</div>'. |
|
75 | + '<div class="debug-content"> ' . implode("<br>\n", $dump) . '</div></div>'; |
|
76 | + break; |
|
77 | + } |
|
78 | + if ($options['echo']) { |
|
79 | + $this->__out(); |
|
80 | + } |
|
81 | 81 | } |
82 | 82 | |
83 | - /** |
|
84 | - * Return output dump as array |
|
85 | - * |
|
86 | - * @param string $key |
|
87 | - * @return array |
|
88 | - */ |
|
89 | - public function array_out($key = null) : array |
|
83 | + /** |
|
84 | + * Return output dump as array |
|
85 | + * |
|
86 | + * @param string $key |
|
87 | + * @return array |
|
88 | + */ |
|
89 | + public function array_out($key = null) : array |
|
90 | 90 | { |
91 | - if (count($this->output) < 2 || ($key && !isset($this->output[$key]))) { |
|
92 | - return []; |
|
93 | - } |
|
94 | - if ($key) { |
|
95 | - return $this->output[$key]; |
|
96 | - } |
|
97 | - array_shift($this->output); |
|
98 | - return $this->output; |
|
99 | - } |
|
91 | + if (count($this->output) < 2 || ($key && !isset($this->output[$key]))) { |
|
92 | + return []; |
|
93 | + } |
|
94 | + if ($key) { |
|
95 | + return $this->output[$key]; |
|
96 | + } |
|
97 | + array_shift($this->output); |
|
98 | + return $this->output; |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * Echo out stored debugging |
|
103 | - * |
|
104 | - * @param int $key |
|
105 | - */ |
|
106 | - public function out($key = null) : void |
|
101 | + /** |
|
102 | + * Echo out stored debugging |
|
103 | + * |
|
104 | + * @param int $key |
|
105 | + */ |
|
106 | + public function out($key = null) : void |
|
107 | 107 | { |
108 | - if ($this->options['mode'] == 'Html') { |
|
109 | - \alkemann\h2l\internals\debug\adapters\Html::top($this->output, $key); |
|
110 | - return; |
|
111 | - } |
|
112 | - $this->__out($key); |
|
113 | - } |
|
108 | + if ($this->options['mode'] == 'Html') { |
|
109 | + \alkemann\h2l\internals\debug\adapters\Html::top($this->output, $key); |
|
110 | + return; |
|
111 | + } |
|
112 | + $this->__out($key); |
|
113 | + } |
|
114 | 114 | |
115 | - private function __out($key = null) : void |
|
115 | + private function __out($key = null) : void |
|
116 | 116 | { |
117 | - if ($key !== null) { |
|
118 | - if (!isset($this->output[$key])) { |
|
119 | - throw new Exception('DEBUG: Not that many outputs in buffer'); |
|
120 | - } |
|
121 | - echo $this->output[$key]; |
|
122 | - return; |
|
123 | - } |
|
124 | - foreach ($this->output as $out) { |
|
125 | - echo $out; |
|
126 | - } |
|
127 | - $this->output = array(); |
|
128 | - } |
|
117 | + if ($key !== null) { |
|
118 | + if (!isset($this->output[$key])) { |
|
119 | + throw new Exception('DEBUG: Not that many outputs in buffer'); |
|
120 | + } |
|
121 | + echo $this->output[$key]; |
|
122 | + return; |
|
123 | + } |
|
124 | + foreach ($this->output as $out) { |
|
125 | + echo $out; |
|
126 | + } |
|
127 | + $this->output = array(); |
|
128 | + } |
|
129 | 129 | |
130 | - /** |
|
131 | - * Grab global defines, will start at 'FIRST_APP_CONSTANT', if defined |
|
132 | - * |
|
133 | - * @return array |
|
134 | - */ |
|
130 | + /** |
|
131 | + * Grab global defines, will start at 'FIRST_APP_CONSTANT', if defined |
|
132 | + * |
|
133 | + * @return array |
|
134 | + */ |
|
135 | 135 | public function defines() : array |
136 | 136 | { |
137 | 137 | $defines = get_defined_constants(); |
@@ -145,15 +145,15 @@ discard block |
||
145 | 145 | return $ret; |
146 | 146 | } |
147 | 147 | |
148 | - /** |
|
149 | - * Send a variable to the adapter and return it's formated output |
|
150 | - * |
|
151 | - * @param mixed $var |
|
152 | - * @return string |
|
153 | - */ |
|
148 | + /** |
|
149 | + * Send a variable to the adapter and return it's formated output |
|
150 | + * |
|
151 | + * @param mixed $var |
|
152 | + * @return string |
|
153 | + */ |
|
154 | 154 | public function dump_it($var) : string |
155 | 155 | { |
156 | - $adapter = '\alkemann\h2l\internals\debug\adapters\\'. $this->options['mode']; |
|
156 | + $adapter = '\alkemann\h2l\internals\debug\adapters\\'. $this->options['mode']; |
|
157 | 157 | if (is_array($var)) |
158 | 158 | return $adapter::dump_array($var, $this); |
159 | 159 | elseif (is_object($var)) |
@@ -162,12 +162,12 @@ discard block |
||
162 | 162 | return $adapter::dump_other($var); |
163 | 163 | } |
164 | 164 | |
165 | - /** |
|
166 | - * Create an array that describes the location of the debug call |
|
167 | - * |
|
168 | - * @param string $trace |
|
169 | - * @return array |
|
170 | - */ |
|
165 | + /** |
|
166 | + * Create an array that describes the location of the debug call |
|
167 | + * |
|
168 | + * @param string $trace |
|
169 | + * @return array |
|
170 | + */ |
|
171 | 171 | public function location($trace) : array |
172 | 172 | { |
173 | 173 | $root = substr($_SERVER['DOCUMENT_ROOT'], 0 , strlen(static::$defaults['docroot']) * -1); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Global convenience methods |
|
4 | - */ |
|
3 | + * Global convenience methods |
|
4 | + */ |
|
5 | 5 | |
6 | 6 | use alkemann\h2l\internals\debug\Debug; |
7 | 7 | |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | $split = false; |
59 | 59 | $args = $args[0]; |
60 | 60 | } |
61 | - $echo = true; |
|
61 | + $echo = true; |
|
62 | 62 | @ob_end_clean(); |
63 | 63 | $debug->dump($args, compact('trace', 'split', 'echo')); |
64 | - if (!empty($debug->output)) { |
|
65 | - dout(); |
|
66 | - } |
|
64 | + if (!empty($debug->output)) { |
|
65 | + dout(); |
|
66 | + } |
|
67 | 67 | die('<div style="margin-top: 25px;font-size: 10px;color: #500;">-Debug die-</div>'); |
68 | 68 | } |
69 | 69 | |
@@ -185,10 +185,10 @@ discard block |
||
185 | 185 | function dout($key = null, $incStyle = true) |
186 | 186 | { |
187 | 187 | $debug = Debug::get_instance(); |
188 | - if ($key && $incStyle) { |
|
189 | - $debug->out(0); |
|
190 | - } |
|
191 | - $debug->out($key); |
|
188 | + if ($key && $incStyle) { |
|
189 | + $debug->out(0); |
|
190 | + } |
|
191 | + $debug->out($key); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -202,5 +202,5 @@ discard block |
||
202 | 202 | function daout($key = null) |
203 | 203 | { |
204 | 204 | $debug = Debug::get_instance(); |
205 | - return $debug->array_out($key); |
|
205 | + return $debug->array_out($key); |
|
206 | 206 | } |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | abstract class Response |
11 | 11 | { |
12 | 12 | public static $code_to_message = [ |
13 | - // Informational 1xx |
|
13 | + // Informational 1xx |
|
14 | 14 | 100 => 'Continue', |
15 | 15 | 101 => 'Switching Protocols', |
16 | - // Successful 2xx |
|
16 | + // Successful 2xx |
|
17 | 17 | 200 => 'OK', |
18 | 18 | 201 => 'Created', |
19 | 19 | 202 => 'Accepted', |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | 204 => 'No Content', |
22 | 22 | 205 => 'Reset Content', |
23 | 23 | 206 => 'Partial Content', |
24 | - // Redirection 3xx |
|
24 | + // Redirection 3xx |
|
25 | 25 | 300 => 'Multiple Choices', |
26 | 26 | 301 => 'Moved Permanently', |
27 | 27 | 302 => 'Found', |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | 304 => 'Not Modified', |
30 | 30 | 305 => 'Use Proxy', |
31 | 31 | 307 => 'Temporary Redirect', |
32 | - // Client Error 4xx |
|
32 | + // Client Error 4xx |
|
33 | 33 | 400 => 'Bad Request', |
34 | 34 | 401 => 'Unauthorized', |
35 | 35 | 402 => 'Payment Required', |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | 415 => 'Unsupported Media Type', |
49 | 49 | 416 => 'Requested Range Not Satisfiable', |
50 | 50 | 417 => 'Expectation Failed', |
51 | - // Server Error 5xx |
|
51 | + // Server Error 5xx |
|
52 | 52 | 500 => 'Internal Server Error', |
53 | 53 | 501 => 'Not Implemented', |
54 | 54 | 502 => 'Bad Gateway', |