Passed
Push — master ( e91ca4...1ae071 )
by Alexander
03:08
created
src/components/Debug/Exceptions/FrameHandler/Supervisor.php 1 patch
Indentation   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -31,156 +31,156 @@
 block discarded – undo
31 31
  */
32 32
 class Supervisor
33 33
 {
34
-	/**
35
-	 * Get exception. 
36
-	 * 
37
-	 * @var \Throwable $exception
38
-	 */
39
-	protected $exception;
40
-
41
-	/**
42
-	 * The frame execute errors.
43
-	 * 
44
-	 * @var string $frames
45
-	 */
46
-	protected $frames;
47
-
48
-	/**
49
-	 * Constructor. The Supervisor class instance.
50
-	 * 
51
-	 * @param  \Throwable  $exception
52
-	 * 
53
-	 * @return string
54
-	 */
55
-	public function __construct($exception)
56
-	{
57
-		$this->exception = $exception;
58
-	}
34
+    /**
35
+     * Get exception. 
36
+     * 
37
+     * @var \Throwable $exception
38
+     */
39
+    protected $exception;
40
+
41
+    /**
42
+     * The frame execute errors.
43
+     * 
44
+     * @var string $frames
45
+     */
46
+    protected $frames;
47
+
48
+    /**
49
+     * Constructor. The Supervisor class instance.
50
+     * 
51
+     * @param  \Throwable  $exception
52
+     * 
53
+     * @return string
54
+     */
55
+    public function __construct($exception)
56
+    {
57
+        $this->exception = $exception;
58
+    }
59 59
 	
60
-	/**
61
-	 * Returns an iterator for the inspected exception's frames.
62
-	 * 
63
-	 * @param  \Throwable  $exception
64
-	 * 
65
-	 * @return array 
66
-	 */
67
-	public function getFrames()
68
-	{
69
-		if ($this->frames === null) {
70
-			$frames = $this->getTrace($this->exception);	
71
-
72
-			// Fill empty line/file info for call_user_func_array usages 
73
-			foreach ($frames as $k => $frame) {
74
-				if (empty($frame['file'])) {
75
-					// Default values when file and line are missing
76
-					$file = '[PHP internal Code]';
77
-					$line = 0;
78
-					$next_frame = ! empty($frames[$k + 1]) ? $frames[$k + 1] : [];
79
-					$frames[$k]['file'] = $file;
80
-					$frames[$k]['line'] = $line;
81
-				}
82
-			}
60
+    /**
61
+     * Returns an iterator for the inspected exception's frames.
62
+     * 
63
+     * @param  \Throwable  $exception
64
+     * 
65
+     * @return array 
66
+     */
67
+    public function getFrames()
68
+    {
69
+        if ($this->frames === null) {
70
+            $frames = $this->getTrace($this->exception);	
71
+
72
+            // Fill empty line/file info for call_user_func_array usages 
73
+            foreach ($frames as $k => $frame) {
74
+                if (empty($frame['file'])) {
75
+                    // Default values when file and line are missing
76
+                    $file = '[PHP internal Code]';
77
+                    $line = 0;
78
+                    $next_frame = ! empty($frames[$k + 1]) ? $frames[$k + 1] : [];
79
+                    $frames[$k]['file'] = $file;
80
+                    $frames[$k]['line'] = $line;
81
+                }
82
+            }
83 83
 			
84
-			// Find latest non-error handling frame index ($i) used to remove error handling frames
85
-			$i = 0;
86
-
87
-			foreach ($frames as $k => $frame) {
88
-				if ($frame['file'] == $this->exception->getFile() && $frame['line'] == $this->exception->getLine()) {
89
-					$i = $k;
90
-				}
91
-			}
92
-			// Remove error handling frames
93
-			if ($i > 0) {
94
-				array_splice($frames, 0, $i);
95
-			}
84
+            // Find latest non-error handling frame index ($i) used to remove error handling frames
85
+            $i = 0;
86
+
87
+            foreach ($frames as $k => $frame) {
88
+                if ($frame['file'] == $this->exception->getFile() && $frame['line'] == $this->exception->getLine()) {
89
+                    $i = $k;
90
+                }
91
+            }
92
+            // Remove error handling frames
93
+            if ($i > 0) {
94
+                array_splice($frames, 0, $i);
95
+            }
96 96
 	
97
-			$firstFrame = $this->getFrameFromException($this->exception);	
98
-			array_unshift($frames, $firstFrame);
99
-
100
-			$this->frames = new Collection($frames);
101
-		}
102
-
103
-		return $this->frames;
104
-	}
105
-
106
-	/**
107
-	 * Given an exception, generates an array in the format generated by Exception::getTrace().
108
-	 * 
109
-	 * @param  \Throwable  $exception
110
-	 * 
111
-	 * @return array
112
-	 */
113
-	protected function getFrameFromException(Throwable $exception): array
114
-	{
115
-		return [
116
-			'file'  => $exception->getFile(),
117
-			'line'  => $exception->getLine(),
118
-			'class' => getClass($exception),
119
-			'code'  => $exception->getCode(),
120
-			'args'  => [
121
-				$exception->getMessage(),
122
-			],
123
-		];
124
-	}
125
-
126
-	/**
127
-	 * Gets exception already specified.
128
-	 * 
129
-	 * @return \Throwable
130
-	 */
131
-	public function getException()
132
-	{
133
-		return $this->exception;
134
-	}
135
-
136
-	/**
137
-	 * Gets the message of exception.
138
-	 * 
139
-	 * @return string
140
-	 */
141
-	public function getExceptionMessage(): string
142
-	{
143
-		return $this->exception->getMessage();
144
-	}
145
-
146
-	/**
147
-	 * Gets the class name of exception.
148
-	 * 
149
-	 * @return mixed
150
-	 */
151
-	public function getExceptionName()
152
-	{
153
-		return getClass($this->exception, true);
154
-	}
97
+            $firstFrame = $this->getFrameFromException($this->exception);	
98
+            array_unshift($frames, $firstFrame);
99
+
100
+            $this->frames = new Collection($frames);
101
+        }
102
+
103
+        return $this->frames;
104
+    }
105
+
106
+    /**
107
+     * Given an exception, generates an array in the format generated by Exception::getTrace().
108
+     * 
109
+     * @param  \Throwable  $exception
110
+     * 
111
+     * @return array
112
+     */
113
+    protected function getFrameFromException(Throwable $exception): array
114
+    {
115
+        return [
116
+            'file'  => $exception->getFile(),
117
+            'line'  => $exception->getLine(),
118
+            'class' => getClass($exception),
119
+            'code'  => $exception->getCode(),
120
+            'args'  => [
121
+                $exception->getMessage(),
122
+            ],
123
+        ];
124
+    }
125
+
126
+    /**
127
+     * Gets exception already specified.
128
+     * 
129
+     * @return \Throwable
130
+     */
131
+    public function getException()
132
+    {
133
+        return $this->exception;
134
+    }
135
+
136
+    /**
137
+     * Gets the message of exception.
138
+     * 
139
+     * @return string
140
+     */
141
+    public function getExceptionMessage(): string
142
+    {
143
+        return $this->exception->getMessage();
144
+    }
145
+
146
+    /**
147
+     * Gets the class name of exception.
148
+     * 
149
+     * @return mixed
150
+     */
151
+    public function getExceptionName()
152
+    {
153
+        return getClass($this->exception, true);
154
+    }
155 155
 	
156
-	/**
157
-	 * Gets the backtrace from an exception.
158
-	 * 
159
-	 * @param  \Throwable  $exception
160
-	 * 
161
-	 * @return array
162
-	 */
163
-	protected function getTrace($exception): array
164
-	{
165
-		$traces = $exception->getTrace();
166
-
167
-		if ( ! $exception instanceof ErrorException) {
168
-			return $traces;
169
-		}
170
-
171
-		if ( ! Misc::isFatalError($exception->getSeverity())) {
172
-			return $traces;
173
-		}
174
-
175
-		if ( ! extension_loaded('xdebug') || ! function_exists('xdebug_is_enabled') || ! xdebug_is_enabled()) {
176
-			return $traces;
177
-		}
156
+    /**
157
+     * Gets the backtrace from an exception.
158
+     * 
159
+     * @param  \Throwable  $exception
160
+     * 
161
+     * @return array
162
+     */
163
+    protected function getTrace($exception): array
164
+    {
165
+        $traces = $exception->getTrace();
166
+
167
+        if ( ! $exception instanceof ErrorException) {
168
+            return $traces;
169
+        }
170
+
171
+        if ( ! Misc::isFatalError($exception->getSeverity())) {
172
+            return $traces;
173
+        }
174
+
175
+        if ( ! extension_loaded('xdebug') || ! function_exists('xdebug_is_enabled') || ! xdebug_is_enabled()) {
176
+            return $traces;
177
+        }
178 178
 		
179
-		// Use xdebug to get the full stack trace and remove the shutdown handler stack trace
180
-		$stack = array_reverse(xdebug_get_function_stack());
181
-		$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
182
-		$traces = array_diff_key($stack, $trace);
179
+        // Use xdebug to get the full stack trace and remove the shutdown handler stack trace
180
+        $stack = array_reverse(xdebug_get_function_stack());
181
+        $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
182
+        $traces = array_diff_key($stack, $trace);
183 183
 		
184
-		return $traces;
185
-	}
184
+        return $traces;
185
+    }
186 186
 }
187 187
\ No newline at end of file
Please login to merge, or discard this patch.
src/components/Debug/Exceptions/Handlers/PleasingPageHandler.php 1 patch
Indentation   +411 added lines, -411 removed lines patch added patch discarded remove patch
@@ -39,433 +39,433 @@
 block discarded – undo
39 39
  */
40 40
 class PleasingPageHandler extends MainHandler
41 41
 {
42
-	/**
43
-	 * The brand main of handler.
44
-	 * 
45
-	 * @var string $brand
46
-	 */
47
-	protected $brand = 'Lenevor Debug';
48
-
49
-	/**
50
-	 * A string identifier for a known IDE/text editor, or a closure
51
-	 * that resolves a string that can be used to open a given file
52
-	 * in an editor.
53
-	 * 
54
-	 * @var mixed $editor
55
-	 */
56
-	protected $editor;
57
-
58
-	/**
59
-	 * A list of known editor strings.
60
-	 * 
61
-	 * @var array $editors
62
-	 */
63
-	protected $editors = [
64
-		"vscode"   => "vscode://file/%file:%line",
65
-		"sublime"  => "subl://open?url=file://%file&line=%line",
66
-		"phpstorm" => "phpstorm://open?file://%file&line=%line",
67
-		"textmate" => "txmt://open?url=file://%file&line=%line",
68
-		"atom"     => "atom://core/open/file?filename=%file&line=%line",
69
-	];
42
+    /**
43
+     * The brand main of handler.
44
+     * 
45
+     * @var string $brand
46
+     */
47
+    protected $brand = 'Lenevor Debug';
48
+
49
+    /**
50
+     * A string identifier for a known IDE/text editor, or a closure
51
+     * that resolves a string that can be used to open a given file
52
+     * in an editor.
53
+     * 
54
+     * @var mixed $editor
55
+     */
56
+    protected $editor;
57
+
58
+    /**
59
+     * A list of known editor strings.
60
+     * 
61
+     * @var array $editors
62
+     */
63
+    protected $editors = [
64
+        "vscode"   => "vscode://file/%file:%line",
65
+        "sublime"  => "subl://open?url=file://%file&line=%line",
66
+        "phpstorm" => "phpstorm://open?file://%file&line=%line",
67
+        "textmate" => "txmt://open?url=file://%file&line=%line",
68
+        "atom"     => "atom://core/open/file?filename=%file&line=%line",
69
+    ];
70 70
 	
71
-	/**
72
-	 * The page title main of handler.
73
-	 * 
74
-	 * @var string $pageTitle
75
-	 */
76
-	protected $pageTitle = 'Lenevor Debug! There was an error.';
71
+    /**
72
+     * The page title main of handler.
73
+     * 
74
+     * @var string $pageTitle
75
+     */
76
+    protected $pageTitle = 'Lenevor Debug! There was an error.';
77 77
 	
78
-	/**
79
-	 * Fast lookup cache for known resource locations.
80
-	 * 
81
-	 * @var array $resourceCache
82
-	 */
83
-	protected $resourceCache = [];
78
+    /**
79
+     * Fast lookup cache for known resource locations.
80
+     * 
81
+     * @var array $resourceCache
82
+     */
83
+    protected $resourceCache = [];
84 84
 	
85
-	/**
86
-	 * The path to the directory containing the html error template directories.
87
-	 * 
88
-	 * @var array $searchPaths
89
-	 */
90
-	protected $searchPaths = [];
91
-
92
-	/**
93
-	 * Gets the table of data.
94
-	 * 
95
-	 * @var array $tables
96
-	 */
97
-	protected $tables = [];
85
+    /**
86
+     * The path to the directory containing the html error template directories.
87
+     * 
88
+     * @var array $searchPaths
89
+     */
90
+    protected $searchPaths = [];
91
+
92
+    /**
93
+     * Gets the table of data.
94
+     * 
95
+     * @var array $tables
96
+     */
97
+    protected $tables = [];
98 98
 	
99
-	/**
100
-	 * The template handler system.
101
-	 * 
102
-	 * @var string|object $template
103
-	 */
104
-	protected $template;	
99
+    /**
100
+     * The template handler system.
101
+     * 
102
+     * @var string|object $template
103
+     */
104
+    protected $template;	
105 105
 	
106
-	/**
107
-	 * Constructor. The PleasingPageHandler class.
108
-	 * 
109
-	 * @return void
110
-	 */
111
-	public function __construct()
112
-	{
113
-		$this->template      = new TemplateHandler;
114
-		$this->searchPaths[] = dirname(__DIR__).DIRECTORY_SEPARATOR.'Resources';
115
-	}
116
-
117
-	/**
118
-	 * Adds an editor resolver, identified by a string name, and that may be a 
119
-	 * string path, or a callable resolver.
120
-	 * 
121
-	 * @param  string            $identifier
122
-	 * @param  string|\Callable  $resolver
123
-	 * 
124
-	 * @return void
125
-	 */
126
-	public function addEditor($identifier, $resolver): void
127
-	{
128
-		$this->editors[$identifier] = $resolver;
129
-	}
130
-
131
-	/**
132
-	 * Adds an entry to the list of tables displayed in the template.
133
-	 * The expected data is a simple associative array. Any nested arrays
134
-	 * will be flattened with print_r.
135
-	 * 
136
-	 * @param  \Syscodes\Components\Contracts\Debug\Table  $table
137
-	 * 
138
-	 * @return void
139
-	 */
140
-	public function addTables(Table $table): void
141
-	{
142
-		$this->tables[] = $table;
143
-	}
106
+    /**
107
+     * Constructor. The PleasingPageHandler class.
108
+     * 
109
+     * @return void
110
+     */
111
+    public function __construct()
112
+    {
113
+        $this->template      = new TemplateHandler;
114
+        $this->searchPaths[] = dirname(__DIR__).DIRECTORY_SEPARATOR.'Resources';
115
+    }
116
+
117
+    /**
118
+     * Adds an editor resolver, identified by a string name, and that may be a 
119
+     * string path, or a callable resolver.
120
+     * 
121
+     * @param  string            $identifier
122
+     * @param  string|\Callable  $resolver
123
+     * 
124
+     * @return void
125
+     */
126
+    public function addEditor($identifier, $resolver): void
127
+    {
128
+        $this->editors[$identifier] = $resolver;
129
+    }
130
+
131
+    /**
132
+     * Adds an entry to the list of tables displayed in the template.
133
+     * The expected data is a simple associative array. Any nested arrays
134
+     * will be flattened with print_r.
135
+     * 
136
+     * @param  \Syscodes\Components\Contracts\Debug\Table  $table
137
+     * 
138
+     * @return void
139
+     */
140
+    public function addTables(Table $table): void
141
+    {
142
+        $this->tables[] = $table;
143
+    }
144 144
 	
145
-	/**
146
-	 * Gathers the variables that will be made available to the view.
147
-	 * 
148
-	 * @return  array
149
-	 */
150
-	protected function collectionVars(): array
151
-	{
152
-		$supervisor = $this->getSupervisor();
153
-		$style      = file_get_contents($this->getResource('css/debug.base.css'));
154
-		$jscript    = file_get_contents($this->getResource('js/debug.base.js'));
155
-		$tables     = array_merge($this->getDefaultTables(), $this->tables);
145
+    /**
146
+     * Gathers the variables that will be made available to the view.
147
+     * 
148
+     * @return  array
149
+     */
150
+    protected function collectionVars(): array
151
+    {
152
+        $supervisor = $this->getSupervisor();
153
+        $style      = file_get_contents($this->getResource('css/debug.base.css'));
154
+        $jscript    = file_get_contents($this->getResource('js/debug.base.js'));
155
+        $tables     = array_merge($this->getDefaultTables(), $this->tables);
156 156
 		
157
-		return [ 
158
-			'class' => explode('\\', $supervisor->getExceptionName()),
159
-			'stylesheet' => preg_replace('#[\r\n\t ]+#', ' ', $style),
160
-			'javascript' => preg_replace('#[\r\n\t ]+#', ' ', $jscript),
161
-			'header' => $this->getResource('views/partials/header.php'),
162
-			'footer' => $this->getResource('views/partials/footer.php'),
163
-			'info_exception' => $this->getResource('views/partials/info/info_exception.php'),
164
-			'section_stack_exception' => $this->getResource('views/partials/section_stack_exception.php'),
165
-			'section_frame' => $this->getResource('views/partials/frames/section_frame.php'),
166
-			'frame_description' => $this->getResource('views/partials/frames/frame_description.php'),
167
-			'frame_list' => $this->getResource('views/partials/frames//frame_list.php'),
168
-			'section_code' => $this->getResource('views/partials/codes/section_code.php'),
169
-			'code_source' => $this->getResource('views/partials/codes/code_source.php'),
170
-			'request_info' => $this->getResource('views/partials/request_info.php'),
171
-			'navigation' => $this->getResource('views/partials/details/navigation.php'),
172
-			'section_detail_context' => $this->getResource('views/partials/details/section_detail_context.php'),
173
-			'plain_exception' => Formatter::formatExceptionAsPlainText($this->getSupervisor()),
174
-			'handler' => $this,
175
-			'handlers' => $this->getDebug()->getHandlers(),
176
-			'debug' => $this->getDebug(),
177
-			'code' => $this->getExceptionCode(),
178
-			'message' => $supervisor->getExceptionMessage(),
179
-			'frames' => $this->getExceptionFrames(),
180
-			'tables' => $this->getProcessTables($tables),
181
-		];
182
-	}
157
+        return [ 
158
+            'class' => explode('\\', $supervisor->getExceptionName()),
159
+            'stylesheet' => preg_replace('#[\r\n\t ]+#', ' ', $style),
160
+            'javascript' => preg_replace('#[\r\n\t ]+#', ' ', $jscript),
161
+            'header' => $this->getResource('views/partials/header.php'),
162
+            'footer' => $this->getResource('views/partials/footer.php'),
163
+            'info_exception' => $this->getResource('views/partials/info/info_exception.php'),
164
+            'section_stack_exception' => $this->getResource('views/partials/section_stack_exception.php'),
165
+            'section_frame' => $this->getResource('views/partials/frames/section_frame.php'),
166
+            'frame_description' => $this->getResource('views/partials/frames/frame_description.php'),
167
+            'frame_list' => $this->getResource('views/partials/frames//frame_list.php'),
168
+            'section_code' => $this->getResource('views/partials/codes/section_code.php'),
169
+            'code_source' => $this->getResource('views/partials/codes/code_source.php'),
170
+            'request_info' => $this->getResource('views/partials/request_info.php'),
171
+            'navigation' => $this->getResource('views/partials/details/navigation.php'),
172
+            'section_detail_context' => $this->getResource('views/partials/details/section_detail_context.php'),
173
+            'plain_exception' => Formatter::formatExceptionAsPlainText($this->getSupervisor()),
174
+            'handler' => $this,
175
+            'handlers' => $this->getDebug()->getHandlers(),
176
+            'debug' => $this->getDebug(),
177
+            'code' => $this->getExceptionCode(),
178
+            'message' => $supervisor->getExceptionMessage(),
179
+            'frames' => $this->getExceptionFrames(),
180
+            'tables' => $this->getProcessTables($tables),
181
+        ];
182
+    }
183 183
 	
184
-	/**
185
-	 * The way in which the data sender (usually the server) can tell the recipient
186
-	 * (the browser, in general) what type of data is being sent in this case, html format tagged.
187
-	 * 
188
-	 * @return string
189
-	 */
190
-	public function contentType(): string
191
-	{
192
-		return 'text/html;charset=UTF-8';
193
-	}
194
-
195
-	/**
196
-	 * Gets the brand of project.
197
-	 * 
198
-	 * @return string
199
-	 */
200
-	public function getBrand(): string
201
-	{
202
-		return $this->brand;
203
-	}
204
-
205
-	/**
206
-	 * Returns the default tables.
207
-	 * 
208
-	 * @return \Syscodes\Components\Contracts\Debug\Table[]
209
-	 */
210
-	protected function getDefaultTables()
211
-	{
212
-		return [
213
-			new ArrayTable('GET Data', $_GET),
214
-			new ArrayTable('POST Data', $_POST),
215
-			new ArrayTable('Files', $_FILES),
216
-			new ArrayTable('Cookie', $_COOKIE),
217
-			new ArrayTable('Session', isset($_SESSION) ? $_SESSION : []),
218
-			new ArrayTable('Server/Request Data', $_SERVER),
219
-			new ArrayTable(__('exception.environmentVars'), $_ENV),
220
-		];
221
-	}
222
-
223
-	/**
224
-	 * Get the code of the exception that is currently being handled.
225
-	 * 
226
-	 * @return string
227
-	 */
228
-	protected function getExceptionCode()
229
-	{
230
-		$exception = $this->getException();
231
-		$code      = $exception->getCode();
232
-
233
-		if ($exception instanceof ErrorException) {
234
-			$code = Misc::translateErrorCode($exception->getSeverity());
235
-		}
236
-
237
-		return (string) $code;
238
-	}
239
-
240
-	/**
241
-	 * Get the stack trace frames of the exception that is currently being handled.
242
-	 * 
243
-	 * @return \Syscodes\Components\Debug\Engine\Supervisor;
244
-	 */
245
-	protected function getExceptionFrames()
246
-	{
247
-		$frames = $this->getSupervisor()->getFrames();
184
+    /**
185
+     * The way in which the data sender (usually the server) can tell the recipient
186
+     * (the browser, in general) what type of data is being sent in this case, html format tagged.
187
+     * 
188
+     * @return string
189
+     */
190
+    public function contentType(): string
191
+    {
192
+        return 'text/html;charset=UTF-8';
193
+    }
194
+
195
+    /**
196
+     * Gets the brand of project.
197
+     * 
198
+     * @return string
199
+     */
200
+    public function getBrand(): string
201
+    {
202
+        return $this->brand;
203
+    }
204
+
205
+    /**
206
+     * Returns the default tables.
207
+     * 
208
+     * @return \Syscodes\Components\Contracts\Debug\Table[]
209
+     */
210
+    protected function getDefaultTables()
211
+    {
212
+        return [
213
+            new ArrayTable('GET Data', $_GET),
214
+            new ArrayTable('POST Data', $_POST),
215
+            new ArrayTable('Files', $_FILES),
216
+            new ArrayTable('Cookie', $_COOKIE),
217
+            new ArrayTable('Session', isset($_SESSION) ? $_SESSION : []),
218
+            new ArrayTable('Server/Request Data', $_SERVER),
219
+            new ArrayTable(__('exception.environmentVars'), $_ENV),
220
+        ];
221
+    }
222
+
223
+    /**
224
+     * Get the code of the exception that is currently being handled.
225
+     * 
226
+     * @return string
227
+     */
228
+    protected function getExceptionCode()
229
+    {
230
+        $exception = $this->getException();
231
+        $code      = $exception->getCode();
232
+
233
+        if ($exception instanceof ErrorException) {
234
+            $code = Misc::translateErrorCode($exception->getSeverity());
235
+        }
236
+
237
+        return (string) $code;
238
+    }
239
+
240
+    /**
241
+     * Get the stack trace frames of the exception that is currently being handled.
242
+     * 
243
+     * @return \Syscodes\Components\Debug\Engine\Supervisor;
244
+     */
245
+    protected function getExceptionFrames()
246
+    {
247
+        $frames = $this->getSupervisor()->getFrames();
248 248
 		
249
-		return $frames;
250
-	}
249
+        return $frames;
250
+    }
251 251
 	
252
-	/**
253
-	 * Gets the page title web.
254
-	 * 
255
-	 * @return string
256
-	 */
257
-	public function getPageTitle(): string
258
-	{
259
-		return $this->pageTitle;
260
-	}
261
-
262
-	/**
263
-	 * Processes an array of tables making sure everything is allright.
264
-	 * 
265
-	 * @param  \Syscodes\Components\Contracts\Debug\Table[]  $tables
266
-	 * 
267
-	 * @return array
268
-	 */
269
-	protected function getProcessTables(array $tables): array
270
-	{
271
-		$processTables = [];
272
-
273
-		foreach ($tables as $table) {
274
-			if ( ! $table instanceof Table) {
275
-				continue;
276
-			}
277
-
278
-			$label = $table->getLabel();
279
-
280
-			try {
281
-				$data = $table->getData();
282
-
283
-				if ( ! (is_array($data) || $data instanceof Traversable)) {
284
-					$data = [];
285
-				}
286
-			} catch (Exception $e) {
287
-				$data = [];
288
-			}
289
-
290
-			$processTables[$label] = $data;
291
-		}
292
-
293
-		return $processTables;
294
-	}
295
-
296
-	/**
297
-	 * Finds a resource, by its relative path, in all available search paths.
298
-	 *
299
-	 * @param  string  $resource
300
-	 * 
301
-	 * @return string
302
-	 * 
303
-	 * @throws \RuntimeException
304
-	 */
305
-	protected function getResource($resource)
306
-	{
307
-		if (isset($this->resourceCache[$resource])) {
308
-			return $this->resourceCache[$resource];
309
-		}
310
-
311
-		foreach ($this->searchPaths as $path) {
312
-			$fullPath = $path.DIRECTORY_SEPARATOR.$resource;
313
-
314
-			if (is_file($fullPath)) {
315
-				// Cache:
316
-				$this->resourceCache[$resource] = $fullPath;
317
-
318
-				return $fullPath;
319
-			}
320
-		}
321
-
322
-		throw new RuntimeException( 
323
-				"Could not find resource '{$resource}' in any resource paths.". 
324
-				"(searched: ".join(", ", $this->searchPaths).")");
325
-	}
252
+    /**
253
+     * Gets the page title web.
254
+     * 
255
+     * @return string
256
+     */
257
+    public function getPageTitle(): string
258
+    {
259
+        return $this->pageTitle;
260
+    }
261
+
262
+    /**
263
+     * Processes an array of tables making sure everything is allright.
264
+     * 
265
+     * @param  \Syscodes\Components\Contracts\Debug\Table[]  $tables
266
+     * 
267
+     * @return array
268
+     */
269
+    protected function getProcessTables(array $tables): array
270
+    {
271
+        $processTables = [];
272
+
273
+        foreach ($tables as $table) {
274
+            if ( ! $table instanceof Table) {
275
+                continue;
276
+            }
277
+
278
+            $label = $table->getLabel();
279
+
280
+            try {
281
+                $data = $table->getData();
282
+
283
+                if ( ! (is_array($data) || $data instanceof Traversable)) {
284
+                    $data = [];
285
+                }
286
+            } catch (Exception $e) {
287
+                $data = [];
288
+            }
289
+
290
+            $processTables[$label] = $data;
291
+        }
292
+
293
+        return $processTables;
294
+    }
295
+
296
+    /**
297
+     * Finds a resource, by its relative path, in all available search paths.
298
+     *
299
+     * @param  string  $resource
300
+     * 
301
+     * @return string
302
+     * 
303
+     * @throws \RuntimeException
304
+     */
305
+    protected function getResource($resource)
306
+    {
307
+        if (isset($this->resourceCache[$resource])) {
308
+            return $this->resourceCache[$resource];
309
+        }
310
+
311
+        foreach ($this->searchPaths as $path) {
312
+            $fullPath = $path.DIRECTORY_SEPARATOR.$resource;
313
+
314
+            if (is_file($fullPath)) {
315
+                // Cache:
316
+                $this->resourceCache[$resource] = $fullPath;
317
+
318
+                return $fullPath;
319
+            }
320
+        }
321
+
322
+        throw new RuntimeException( 
323
+                "Could not find resource '{$resource}' in any resource paths.". 
324
+                "(searched: ".join(", ", $this->searchPaths).")");
325
+    }
326 326
 	
327
-	/**
328
-	 * Given an exception and status code will display the error to the client.
329
-	 * 
330
-	 * @return int|null
331
-	 */
332
-	public function handle()
333
-	{	
334
-		$templatePath = $this->getResource('views/debug.layout.php');
335
-
336
-		$vars = $this->collectionVars();
327
+    /**
328
+     * Given an exception and status code will display the error to the client.
329
+     * 
330
+     * @return int|null
331
+     */
332
+    public function handle()
333
+    {	
334
+        $templatePath = $this->getResource('views/debug.layout.php');
335
+
336
+        $vars = $this->collectionVars();
337 337
 		
338
-		if (empty($vars['message'])) $vars['message'] = __('exception.noMessage');
338
+        if (empty($vars['message'])) $vars['message'] = __('exception.noMessage');
339 339
 		
340
-		$this->template->setVariables($vars);
341
-		$this->template->render($templatePath);
340
+        $this->template->setVariables($vars);
341
+        $this->template->render($templatePath);
342 342
 		
343
-		return MainHandler::QUIT;
344
-	}
345
-
346
-	/**
347
-	 * Set the editor to use to open referenced files, by a string identifier or callable
348
-	 * that will be executed for every file reference. Should return a string.
349
-	 * 
350
-	 * @example  $debug->setEditor(function($file, $line) { return "file:///{$file}"; });
351
-	 * @example  $debug->setEditor('vscode');
352
-	 * 
353
-	 * @param  string  $editor
354
-	 * 
355
-	 * @return void
356
-	 * 
357
-	 * @throws \InvalidArgumentException
358
-	 */
359
-	public function setEditor($editor)
360
-	{
361
-		if ( ! is_callable($editor) && ! isset($this->editors[$editor])) {
362
-			throw new InvalidArgumentException("Unknown editor identifier: [{$editor}]. Known editors: " .
363
-				implode(', ', array_keys($this->editors))
364
-			);
365
-		}
366
-
367
-		$this->editor = $editor;
368
-	}
369
-
370
-	/**
371
-	 * Given a string file path, and an integer file line,
372
-	 * executes the editor resolver and returns.
373
-	 * 
374
-	 * @param  string  $file
375
-	 * @param  int	   $line
376
-	 * 
377
-	 * @return string|bool
378
-	 * 
379
-	 * @throws \UnexpectedValueException
380
-	 */
381
-	public function getEditorAtHref($file, $line)
382
-	{
383
-		$editor = $this->getEditor($file, $line);
384
-
385
-		if (empty($editor))	{
386
-			return false;
387
-		}
388
-
389
-		if ( ! isset($editor['url']) || ! is_string($editor['url'])) {
390
-			throw new UnexpectedValueException(__METHOD__.'should always resolve to a string or a valid editor array');
391
-		}
392
-
393
-		$editor['url'] = str_replace("%file", rawurldecode($file), $editor['url']);
394
-		$editor['url'] = str_replace("%line", rawurldecode($line), $editor['url']);
395
-
396
-		return $editor['url'];
397
-	}
398
-
399
-	/**
400
-	 * The editor must be a valid callable function/closure.
401
-	 * 
402
-	 * @param  string  $file
403
-	 * @param  int	   $line
404
-	 * 
405
-	 * @return array
406
-	 */
407
-	protected function getEditor($file, $line): array
408
-	{
409
-		if ( ! $this->editor || ( ! is_string($this->editor) && ! is_callable($this->editor))) {
410
-			return [];
411
-		}
412
-
413
-		if (is_string($this->editor) && isset($this->editors[$this->editor]) && ! is_callable($this->editors[$this->editor])) {
414
-			return ['url' => $this->editors[$this->editor]];
415
-		}
416
-
417
-		if (is_callable($this->editor) || (isset($this->editors[$this->editor]) && is_callable($this->editors[$this->editor]))) {
418
-			if (is_callable($this->editor)) {
419
-				$callback = call_user_func($this->editor, $file, $line);
420
-			} else {
421
-				$callback = call_user_func($this->editors[$this->editor], $file, $line);
422
-			}
423
-
424
-			if (empty($callback)) {
425
-				return [];
426
-			}
427
-
428
-			if (is_string($callback)) {
429
-				return ['url' => $callback];
430
-			}
343
+        return MainHandler::QUIT;
344
+    }
345
+
346
+    /**
347
+     * Set the editor to use to open referenced files, by a string identifier or callable
348
+     * that will be executed for every file reference. Should return a string.
349
+     * 
350
+     * @example  $debug->setEditor(function($file, $line) { return "file:///{$file}"; });
351
+     * @example  $debug->setEditor('vscode');
352
+     * 
353
+     * @param  string  $editor
354
+     * 
355
+     * @return void
356
+     * 
357
+     * @throws \InvalidArgumentException
358
+     */
359
+    public function setEditor($editor)
360
+    {
361
+        if ( ! is_callable($editor) && ! isset($this->editors[$editor])) {
362
+            throw new InvalidArgumentException("Unknown editor identifier: [{$editor}]. Known editors: " .
363
+                implode(', ', array_keys($this->editors))
364
+            );
365
+        }
366
+
367
+        $this->editor = $editor;
368
+    }
369
+
370
+    /**
371
+     * Given a string file path, and an integer file line,
372
+     * executes the editor resolver and returns.
373
+     * 
374
+     * @param  string  $file
375
+     * @param  int	   $line
376
+     * 
377
+     * @return string|bool
378
+     * 
379
+     * @throws \UnexpectedValueException
380
+     */
381
+    public function getEditorAtHref($file, $line)
382
+    {
383
+        $editor = $this->getEditor($file, $line);
384
+
385
+        if (empty($editor))	{
386
+            return false;
387
+        }
388
+
389
+        if ( ! isset($editor['url']) || ! is_string($editor['url'])) {
390
+            throw new UnexpectedValueException(__METHOD__.'should always resolve to a string or a valid editor array');
391
+        }
392
+
393
+        $editor['url'] = str_replace("%file", rawurldecode($file), $editor['url']);
394
+        $editor['url'] = str_replace("%line", rawurldecode($line), $editor['url']);
395
+
396
+        return $editor['url'];
397
+    }
398
+
399
+    /**
400
+     * The editor must be a valid callable function/closure.
401
+     * 
402
+     * @param  string  $file
403
+     * @param  int	   $line
404
+     * 
405
+     * @return array
406
+     */
407
+    protected function getEditor($file, $line): array
408
+    {
409
+        if ( ! $this->editor || ( ! is_string($this->editor) && ! is_callable($this->editor))) {
410
+            return [];
411
+        }
412
+
413
+        if (is_string($this->editor) && isset($this->editors[$this->editor]) && ! is_callable($this->editors[$this->editor])) {
414
+            return ['url' => $this->editors[$this->editor]];
415
+        }
416
+
417
+        if (is_callable($this->editor) || (isset($this->editors[$this->editor]) && is_callable($this->editors[$this->editor]))) {
418
+            if (is_callable($this->editor)) {
419
+                $callback = call_user_func($this->editor, $file, $line);
420
+            } else {
421
+                $callback = call_user_func($this->editors[$this->editor], $file, $line);
422
+            }
423
+
424
+            if (empty($callback)) {
425
+                return [];
426
+            }
427
+
428
+            if (is_string($callback)) {
429
+                return ['url' => $callback];
430
+            }
431 431
 			
432
-			return ['url' => isset($callback['url']) ? $callback['url'] : $callback];
433
-		}
432
+            return ['url' => isset($callback['url']) ? $callback['url'] : $callback];
433
+        }
434 434
 		
435
-		return [];
436
-	}
437
-
438
-	/**
439
-	 * Registered the editor.
440
-	 * 
441
-	 * @return string
442
-	 */
443
-	public function getEditorcode(): string
444
-	{
445
-		return $this->editor;
446
-	}
435
+        return [];
436
+    }
437
+
438
+    /**
439
+     * Registered the editor.
440
+     * 
441
+     * @return string
442
+     */
443
+    public function getEditorcode(): string
444
+    {
445
+        return $this->editor;
446
+    }
447 447
 	
448
-	/**
449
-	 * Sets the brand of project.
450
-	 * 
451
-	 * @param  string  $brand
452
-	 * 
453
-	 * @return void
454
-	 */
455
-	public function setBrand($brand): void
456
-	{
457
-		$this->brand = (string) $brand;
458
-	}
448
+    /**
449
+     * Sets the brand of project.
450
+     * 
451
+     * @param  string  $brand
452
+     * 
453
+     * @return void
454
+     */
455
+    public function setBrand($brand): void
456
+    {
457
+        $this->brand = (string) $brand;
458
+    }
459 459
 	
460
-	/**
461
-	 * Sets the page title web.
462
-	 * 
463
-	 * @param  string  $title
464
-	 * 
465
-	 * @return void
466
-	 */
467
-	public function setPageTitle($title): void
468
-	{
469
-		$this->pageTitle = (string) $title;
470
-	}
460
+    /**
461
+     * Sets the page title web.
462
+     * 
463
+     * @param  string  $title
464
+     * 
465
+     * @return void
466
+     */
467
+    public function setPageTitle($title): void
468
+    {
469
+        $this->pageTitle = (string) $title;
470
+    }
471 471
 }
472 472
\ No newline at end of file
Please login to merge, or discard this patch.