Completed
Push — 0.7.0 ( 7b3d84 )
by Alexander
15s queued 14s
created
src/components/Pipeline/Pipeline.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
      */
152 152
     protected function call()
153 153
     {
154
-        return function ($stack, $pipe) {
155
-            return function ($passable) use ($stack, $pipe) {
154
+        return function($stack, $pipe) {
155
+            return function($passable) use ($stack, $pipe) {
156 156
                 try {
157 157
                     if (is_callable($pipe)) {
158 158
                         return $pipe($passable, $stack);
@@ -205,10 +205,10 @@  discard block
 block discarded – undo
205 205
      */
206 206
     protected function prepareDestination(Closure $destination)
207 207
     {
208
-        return function ($passable) use ($destination) {
208
+        return function($passable) use ($destination) {
209 209
             try {
210 210
                 return $destination($passable);
211
-            } catch(Throwable $e)  {
211
+            } catch (Throwable $e) {
212 212
                 return $this->handleException($passable, $e);
213 213
             }
214 214
         };
Please login to merge, or discard this patch.
src/components/Http/RedirectResponse.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -99,13 +99,13 @@
 block discarded – undo
99 99
     }
100 100
 
101 101
     /**
102
-    * Redirects to another url. Sets the redirect header, sends the headers and exits.
103
-    * Can redirect via a Location header.
104
-    *
105
-    * @param  string  $url  The url
106
-    *
107
-    * @return $this
108
-    */
102
+     * Redirects to another url. Sets the redirect header, sends the headers and exits.
103
+     * Can redirect via a Location header.
104
+     *
105
+     * @param  string  $url  The url
106
+     *
107
+     * @return $this
108
+     */
109 109
     public function setTargetUrl($url)
110 110
     {
111 111
         if ('' === ($url ?? '')) {
Please login to merge, or discard this patch.
src/components/Http/Response.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@
 block discarded – undo
122 122
 			$replace = 0 === strcasecmp($name, 'Content-Type');
123 123
 
124 124
 			foreach ($values as $value) {
125
-				header($name.': '. $value, $replace, $this->status);
125
+				header($name.': '.$value, $replace, $this->status);
126 126
 			}
127 127
 		}
128 128
 
Please login to merge, or discard this patch.
Indentation   +286 added lines, -286 removed lines patch added patch discarded remove patch
@@ -39,297 +39,297 @@
 block discarded – undo
39 39
  */
40 40
 class Response extends Status 
41 41
 {
42
-	use ResponseTrait;
43
-
44
-	/**
45
-	 * Sets up the response with a content and a status code.
46
-	 *
47
-	 * @param  mixed  $content  The response content 
48
-	 * @param  int  $status  The response status  
49
-	 * @param  array  $headers  Array of HTTP headers for this response
50
-	 *
51
-	 * @return string
52
-	 */
53
-	public function __construct($content = '', int $status = 200, array $headers = [])
54
-	{
55
-		$this->setContent($content);
56
-		$this->setStatusCode($status);
42
+    use ResponseTrait;
43
+
44
+    /**
45
+     * Sets up the response with a content and a status code.
46
+     *
47
+     * @param  mixed  $content  The response content 
48
+     * @param  int  $status  The response status  
49
+     * @param  array  $headers  Array of HTTP headers for this response
50
+     *
51
+     * @return string
52
+     */
53
+    public function __construct($content = '', int $status = 200, array $headers = [])
54
+    {
55
+        $this->setContent($content);
56
+        $this->setStatusCode($status);
57 57
 		
58
-		$this->server  = new Server($_SERVER);
59
-		$this->headers = new Headers($headers);
60
-	}
61
-
62
-	/**
63
-	 * Creates an instance of the same response class for rendering contents to the content, 
64
-	 * status code and headers.
65
-	 *
66
-	 * @param  mixed  $content  The response content  
67
-	 * @param  int  $status  The HTTP response status for this response  
68
-	 * @param  array  $headers  Array of HTTP headers for this response
69
-	 *
70
-	 * @return static
71
-	 */
72
-	public static function render($content = '', $status = 200, $headers = [])
73
-	{
74
-		return new static($content, $status, $headers);
75
-	}
76
-
77
-	/**
78
-	 * Gets the current response content.
79
-	 * 
80
-	 * @return string
81
-	 */
82
-	public function getContent()
83
-	{
84
-		return $this->content;
85
-	}
86
-
87
-	/**
88
-	 * Gets the response status code.
89
-	 *
90
-	 * The status code is a 3-digit code to specify server response results to the browser.
91
-	 *
92
-	 * @return int
93
-	 *
94
-	 * @throws \BadMethodCallException
95
-	 */
96
-	public function getStatusCode()
97
-	{
98
-		if (empty($this->status)) {
99
-			throw new BadMethodCallException('HTTP Response is missing a status code.');
100
-		}
101
-
102
-		return $this->status;
103
-	}
104
-
105
-	/**
106
-	 * Sends the headers if they haven't already been sent. 
107
-	 * Returns whether they were sent or not.
108
-	 *
109
-	 * @return bool
110
-	 *
111
-	 * @uses   \Syscodes\Http\Http
112
-	 */
113
-	public function sendHeaders()
114
-	{
115
-		// Have the headers already been sent?
116
-		if (headers_sent()) {
117
-			return $this;
118
-		}
119
-
120
-		// Headers
121
-		foreach ($this->headers->allPreserveCase() as $name => $values) {
122
-			$replace = 0 === strcasecmp($name, 'Content-Type');
123
-
124
-			foreach ($values as $value) {
125
-				header($name.': '. $value, $replace, $this->status);
126
-			}
127
-		}
128
-
129
-		// Status
130
-		if ( ! empty($_SERVER['FCGI_SERVER_VERSION'])) {
131
-			// Send the protocol/status line first, FCGI servers need different status header
132
-			header(sprintf('Status: %s %s', $this->status, $this->statusText));
133
-		} else {
134
-			$this->protocol = (string) $this->server->get('SERVER_PROTOCOL') ?: 'HTTP/1.1';
135
-			header(sprintf('%s %s %s', $this->protocol, $this->status, $this->statusText), true, $this->status);
136
-		}
137
-
138
-		return $this;
139
-	}
140
-
141
-	/**
142
-	 * Sends content for the current web response.
143
-	 * 
144
-	 * @return $this
145
-	 */
146
-	public function sendContent()
147
-	{
148
-		echo $this->content;
149
-
150
-		return $this;
151
-	}
152
-
153
-	/**
154
-	 * Sends the response to the output buffer. Optionally, headers will be sent. 
155
-	 *
156
-	 * @param  bool  $sendHeader  Whether or not to send the defined HTTP headers
157
-	 *
158
-	 * @return $this
159
-	 */
160
-	public function send($sendHeader = false)
161
-	{
162
-		if ($sendHeader) {
163
-			$this->sendHeaders();
164
-		}
165
-
166
-		if (null !== $this->content) {
167
-			$this->sendContent();
168
-		}
169
-
170
-		return $this;
171
-	}
172
-
173
-	/**
174
-	 * Sends the content of the message to the browser.
175
-	 *
176
-	 * @param  mixed  $content  The response content
177
-	 *
178
-	 * @return $this
179
-	 */
180
-	public function setContent($content)
181
-	{
182
-		if ($content !== null && ! is_string($content) && ! is_numeric($content) && ! is_callable([$content, '__toString'])) {
183
-			throw new UnexpectedValueException(sprintf('The Response content must be a string or object implementing __toString(), "%s" given.', gettype($content)));
184
-		}
185
-
186
-		if ($content instanceof JsonSerializable || is_array($content)) {
187
-			$this->header('Content-Type', 'application/json');
188
-
189
-			$content = json_encode($content);
190
-		} elseif ($content instanceof Renderable) {
191
-			$content = $content->render();
192
-		}
58
+        $this->server  = new Server($_SERVER);
59
+        $this->headers = new Headers($headers);
60
+    }
61
+
62
+    /**
63
+     * Creates an instance of the same response class for rendering contents to the content, 
64
+     * status code and headers.
65
+     *
66
+     * @param  mixed  $content  The response content  
67
+     * @param  int  $status  The HTTP response status for this response  
68
+     * @param  array  $headers  Array of HTTP headers for this response
69
+     *
70
+     * @return static
71
+     */
72
+    public static function render($content = '', $status = 200, $headers = [])
73
+    {
74
+        return new static($content, $status, $headers);
75
+    }
76
+
77
+    /**
78
+     * Gets the current response content.
79
+     * 
80
+     * @return string
81
+     */
82
+    public function getContent()
83
+    {
84
+        return $this->content;
85
+    }
86
+
87
+    /**
88
+     * Gets the response status code.
89
+     *
90
+     * The status code is a 3-digit code to specify server response results to the browser.
91
+     *
92
+     * @return int
93
+     *
94
+     * @throws \BadMethodCallException
95
+     */
96
+    public function getStatusCode()
97
+    {
98
+        if (empty($this->status)) {
99
+            throw new BadMethodCallException('HTTP Response is missing a status code.');
100
+        }
101
+
102
+        return $this->status;
103
+    }
104
+
105
+    /**
106
+     * Sends the headers if they haven't already been sent. 
107
+     * Returns whether they were sent or not.
108
+     *
109
+     * @return bool
110
+     *
111
+     * @uses   \Syscodes\Http\Http
112
+     */
113
+    public function sendHeaders()
114
+    {
115
+        // Have the headers already been sent?
116
+        if (headers_sent()) {
117
+            return $this;
118
+        }
119
+
120
+        // Headers
121
+        foreach ($this->headers->allPreserveCase() as $name => $values) {
122
+            $replace = 0 === strcasecmp($name, 'Content-Type');
123
+
124
+            foreach ($values as $value) {
125
+                header($name.': '. $value, $replace, $this->status);
126
+            }
127
+        }
128
+
129
+        // Status
130
+        if ( ! empty($_SERVER['FCGI_SERVER_VERSION'])) {
131
+            // Send the protocol/status line first, FCGI servers need different status header
132
+            header(sprintf('Status: %s %s', $this->status, $this->statusText));
133
+        } else {
134
+            $this->protocol = (string) $this->server->get('SERVER_PROTOCOL') ?: 'HTTP/1.1';
135
+            header(sprintf('%s %s %s', $this->protocol, $this->status, $this->statusText), true, $this->status);
136
+        }
137
+
138
+        return $this;
139
+    }
140
+
141
+    /**
142
+     * Sends content for the current web response.
143
+     * 
144
+     * @return $this
145
+     */
146
+    public function sendContent()
147
+    {
148
+        echo $this->content;
149
+
150
+        return $this;
151
+    }
152
+
153
+    /**
154
+     * Sends the response to the output buffer. Optionally, headers will be sent. 
155
+     *
156
+     * @param  bool  $sendHeader  Whether or not to send the defined HTTP headers
157
+     *
158
+     * @return $this
159
+     */
160
+    public function send($sendHeader = false)
161
+    {
162
+        if ($sendHeader) {
163
+            $this->sendHeaders();
164
+        }
165
+
166
+        if (null !== $this->content) {
167
+            $this->sendContent();
168
+        }
169
+
170
+        return $this;
171
+    }
172
+
173
+    /**
174
+     * Sends the content of the message to the browser.
175
+     *
176
+     * @param  mixed  $content  The response content
177
+     *
178
+     * @return $this
179
+     */
180
+    public function setContent($content)
181
+    {
182
+        if ($content !== null && ! is_string($content) && ! is_numeric($content) && ! is_callable([$content, '__toString'])) {
183
+            throw new UnexpectedValueException(sprintf('The Response content must be a string or object implementing __toString(), "%s" given.', gettype($content)));
184
+        }
185
+
186
+        if ($content instanceof JsonSerializable || is_array($content)) {
187
+            $this->header('Content-Type', 'application/json');
188
+
189
+            $content = json_encode($content);
190
+        } elseif ($content instanceof Renderable) {
191
+            $content = $content->render();
192
+        }
193 193
 		
194
-		$this->content = $content ?? '';
195
-
196
-		return $this;
197
-	}
198
-
199
-	/**
200
-	 * Prepares the Response before it is sent to the client.
201
-	 * 
202
-	 * @param  \Syscodes\Http\Request  $request
203
-	 * 
204
-	 * @return $this
205
-	 */
206
-	public function prepare($request)
207
-	{
208
-		$headers = $this->headers;
209
-
210
-		if ($this->isInformational() || $this->isEmpty()) {
211
-			$this->setContent(null);
212
-			$headers->remove('Content-Type');
213
-			$headers->remove('Content-Length');
214
-		}
215
-
216
-		return $this;
217
-	}
218
-
219
-	/**
220
-	* Sets the response status code.
221
-	*
222
-	* @param  int  $code  The status code
223
-	* @param  string|null  $text  The status text
224
-	*
225
-	* @return $this
226
-	*
227
-	* @throws \InvalidArgumentException
228
-	*/
229
-	public function setStatusCode(int $code, $text = null)
230
-	{
231
-		$this->status = $code; 
232
-
233
-		// Valid range?
234
-		if ($this->isInvalid()) {
235
-			throw new InvalidArgumentException(__('response.statusCodeNotValid', ['code' => $code]));			
236
-		}
237
-
238
-		// Check if you have an accepted status code if not shows to a message of unknown status
239
-		if (null === $text) {
240
-			$this->statusText = isset($this->statusCodes[$code]) ? $this->statusCodes[$code] : __('response.UnknownStatus');
241
-
242
-			return $this;
243
-		}
244
-
245
-		if (false === $text) {
246
-			$this->statusText = '';
247
-
248
-			return $this;
249
-		}
250
-
251
-		$this->statusText = $text;
252
-
253
-		return $this;
254
-	}
255
-
256
-	/**
257
-	 * Is response invalid?
258
-	 * 
259
-	 * @final
260
-	 * 
261
-	 * @return void
262
-	 */
263
-	public function isInvalid(): bool
264
-	{
265
-		return $this->status < 100 || $this->status >= 600;
266
-	}
267
-
268
-	/**
269
-	 * Is response informative?
270
-	 * 
271
-	 * @final
272
-	 * 
273
-	 * @return void
274
-	 */
275
-	public function isInformational()
276
-	{
277
-		return $this->status >= 100 && $this->status < 200;
278
-	}
194
+        $this->content = $content ?? '';
195
+
196
+        return $this;
197
+    }
198
+
199
+    /**
200
+     * Prepares the Response before it is sent to the client.
201
+     * 
202
+     * @param  \Syscodes\Http\Request  $request
203
+     * 
204
+     * @return $this
205
+     */
206
+    public function prepare($request)
207
+    {
208
+        $headers = $this->headers;
209
+
210
+        if ($this->isInformational() || $this->isEmpty()) {
211
+            $this->setContent(null);
212
+            $headers->remove('Content-Type');
213
+            $headers->remove('Content-Length');
214
+        }
215
+
216
+        return $this;
217
+    }
218
+
219
+    /**
220
+     * Sets the response status code.
221
+     *
222
+     * @param  int  $code  The status code
223
+     * @param  string|null  $text  The status text
224
+     *
225
+     * @return $this
226
+     *
227
+     * @throws \InvalidArgumentException
228
+     */
229
+    public function setStatusCode(int $code, $text = null)
230
+    {
231
+        $this->status = $code; 
232
+
233
+        // Valid range?
234
+        if ($this->isInvalid()) {
235
+            throw new InvalidArgumentException(__('response.statusCodeNotValid', ['code' => $code]));			
236
+        }
237
+
238
+        // Check if you have an accepted status code if not shows to a message of unknown status
239
+        if (null === $text) {
240
+            $this->statusText = isset($this->statusCodes[$code]) ? $this->statusCodes[$code] : __('response.UnknownStatus');
241
+
242
+            return $this;
243
+        }
244
+
245
+        if (false === $text) {
246
+            $this->statusText = '';
247
+
248
+            return $this;
249
+        }
250
+
251
+        $this->statusText = $text;
252
+
253
+        return $this;
254
+    }
255
+
256
+    /**
257
+     * Is response invalid?
258
+     * 
259
+     * @final
260
+     * 
261
+     * @return void
262
+     */
263
+    public function isInvalid(): bool
264
+    {
265
+        return $this->status < 100 || $this->status >= 600;
266
+    }
267
+
268
+    /**
269
+     * Is response informative?
270
+     * 
271
+     * @final
272
+     * 
273
+     * @return void
274
+     */
275
+    public function isInformational()
276
+    {
277
+        return $this->status >= 100 && $this->status < 200;
278
+    }
279 279
 	
280
-	/**
281
-	 * Is the response a redirect?
282
-	 * 
283
-	 * @final
284
-	 * 
285
-	 * @return void
286
-	 */
287
-	public function isRedirection()
288
-	{
289
-		return $this->status >= 300 && $this->status < 400;
290
-	}
280
+    /**
281
+     * Is the response a redirect?
282
+     * 
283
+     * @final
284
+     * 
285
+     * @return void
286
+     */
287
+    public function isRedirection()
288
+    {
289
+        return $this->status >= 300 && $this->status < 400;
290
+    }
291 291
 	
292
-	/**
293
-	 * Is the response empty?
294
-	 * 
295
-	 * @final
296
-	 * 
297
-	 * @return void
298
-	 */
299
-	public function isEmpty()
300
-	{
301
-		return in_array($this->status, [204, 304]);
302
-	}
292
+    /**
293
+     * Is the response empty?
294
+     * 
295
+     * @final
296
+     * 
297
+     * @return void
298
+     */
299
+    public function isEmpty()
300
+    {
301
+        return in_array($this->status, [204, 304]);
302
+    }
303 303
 	
304
-	/**
305
-	 * Is the response a redirect of some form?
306
-	 * 
307
-	 * @return bool
308
-	 */
309
-	public function isRedirect()
310
-	{
311
-		return in_array($this->status, [301, 302, 303, 307, 308]);
312
-	}
304
+    /**
305
+     * Is the response a redirect of some form?
306
+     * 
307
+     * @return bool
308
+     */
309
+    public function isRedirect()
310
+    {
311
+        return in_array($this->status, [301, 302, 303, 307, 308]);
312
+    }
313 313
 	
314
-	/**
315
-	 * Returns the Response as an HTTP string.
316
-	 * 
317
-	 * @return string
318
-	 */
319
-	public function __toString()
320
-	{
321
-		return sprintf('%s %s %s', $this->protocol, $this->status, $this->statusText)."\r\n".
322
-			$this->headers."\r\n".
323
-			$this->getContent();
324
-	}
314
+    /**
315
+     * Returns the Response as an HTTP string.
316
+     * 
317
+     * @return string
318
+     */
319
+    public function __toString()
320
+    {
321
+        return sprintf('%s %s %s', $this->protocol, $this->status, $this->statusText)."\r\n".
322
+            $this->headers."\r\n".
323
+            $this->getContent();
324
+    }
325 325
 	
326
-	/**
327
-	 * Clone the current Response instance.
328
-	 * 
329
-	 * @return void
330
-	 */
331
-	public function __clone()
332
-	{
333
-		$this->headers = clone $this->headers;
334
-	}
326
+    /**
327
+     * Clone the current Response instance.
328
+     * 
329
+     * @return void
330
+     */
331
+    public function __clone()
332
+    {
333
+        $this->headers = clone $this->headers;
334
+    }
335 335
 }
336 336
\ No newline at end of file
Please login to merge, or discard this patch.
src/components/Http/Request.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -860,8 +860,7 @@
 block discarded – undo
860 860
 		try
861 861
 		{
862 862
 			$content = $this->getContent();
863
-		}
864
-		catch (LogicException $e)
863
+		} catch (LogicException $e)
865 864
 		{
866 865
 			if (PHP_VERSION_ID > 70400)
867 866
 			{
Please login to merge, or discard this patch.
Indentation   +873 added lines, -873 removed lines patch added patch discarded remove patch
@@ -41,891 +41,891 @@
 block discarded – undo
41 41
  */
42 42
 class Request
43 43
 {
44
-	/**
45
-	 * Holds the global active request instance.
46
-	 *
47
-	 * @var bool $requestURI
48
-	 */
49
-	protected static $requestURI;
50
-
51
-	/**
52
-	 * The base URL.
53
-	 * 
54
-	 * @var string $baseUrl
55
-	 */
56
-	protected $baseUrl;
57
-
58
-	/**
59
-	 * Gets cookies ($_COOKIE).
60
-	 * 
61
-	 * @var string $cookies
62
-	 */
63
-	public $cookies;
64
-
65
-	/**
66
-	 * Gets the string with format JSON.
67
-	 * 
68
-	 * @var string|resource|null $content
69
-	 */
70
-	protected $content;
71
-
72
-	/**
73
-	 * The default Locale this request.
74
-	 * 
75
-	 * @var string $defaultLocale
76
-	 */
77
-	protected $defaultLocale = 'en';
44
+    /**
45
+     * Holds the global active request instance.
46
+     *
47
+     * @var bool $requestURI
48
+     */
49
+    protected static $requestURI;
50
+
51
+    /**
52
+     * The base URL.
53
+     * 
54
+     * @var string $baseUrl
55
+     */
56
+    protected $baseUrl;
57
+
58
+    /**
59
+     * Gets cookies ($_COOKIE).
60
+     * 
61
+     * @var string $cookies
62
+     */
63
+    public $cookies;
64
+
65
+    /**
66
+     * Gets the string with format JSON.
67
+     * 
68
+     * @var string|resource|null $content
69
+     */
70
+    protected $content;
71
+
72
+    /**
73
+     * The default Locale this request.
74
+     * 
75
+     * @var string $defaultLocale
76
+     */
77
+    protected $defaultLocale = 'en';
78 78
 	
79
-	/**
80
-	 * Gets files request ($_FILES).
81
-	 * 
82
-	 * @var string $files
83
-	 */
84
-	public $files;
85
-
86
-	/**
87
-	 * The detected uri and server variables.
88
-	 * 
89
-	 * @var string $http
90
-	 */
91
-	protected $http;
92
-
93
-	/**
94
-	 * The decoded JSON content for the request.
95
-	 * 
96
-	 * @var \Syscodes\Http\Contributors\Parameters|null $json
97
-	 */
98
-	protected $json;
99
-
100
-	/**
101
-	 * The current language of the application.
102
-	 * 
103
-	 * @var string $languages
104
-	 */
105
-	protected $languages;
79
+    /**
80
+     * Gets files request ($_FILES).
81
+     * 
82
+     * @var string $files
83
+     */
84
+    public $files;
85
+
86
+    /**
87
+     * The detected uri and server variables.
88
+     * 
89
+     * @var string $http
90
+     */
91
+    protected $http;
92
+
93
+    /**
94
+     * The decoded JSON content for the request.
95
+     * 
96
+     * @var \Syscodes\Http\Contributors\Parameters|null $json
97
+     */
98
+    protected $json;
99
+
100
+    /**
101
+     * The current language of the application.
102
+     * 
103
+     * @var string $languages
104
+     */
105
+    protected $languages;
106 106
 	
107
-	/** 
108
-	 * The method name.
109
-	 * 
110
-	 * @var string $method
111
-	 */
112
-	protected $method;
113
-
114
-	/**
115
-	 * The path info of URL.
116
-	 * 
117
-	 * @var string $pathInfo
118
-	 */
119
-	protected $pathInfo;
120
-
121
-	/**
122
-	 * Request body parameters ($_POST).
123
-	 * 
124
-	 * @var \Syscodes\Http\Contributors\Parameters $request
125
-	 */
126
-	public $request;
127
-
128
-	/**
129
-	 * Get request URI.
130
-	 * 
131
-	 * @var string $requestToURI
132
-	 */
133
-	protected $requestToURI;
134
-
135
-	/**
136
-	 * Get the route resolver callback.
137
-	 * 
138
-	 * @var \Closure $routeResolver
139
-	 */
140
-	protected $routeResolver;
141
-
142
-	/**
143
-	 * The detected uri and server variables ($_FILES).
144
-	 * 
145
-	 * @var array $server
146
-	 */
147
-	public $server = [];
148
-
149
-	/** 
150
-	 * List of routes uri.
151
-	 *
152
-	 * @var string|array $uri 
153
-	 */
154
-	public $uri;
155
-
156
-	/**
157
-	 * Stores the valid locale codes.
158
-	 * 
159
-	 * @var array $validLocales
160
-	 */
161
-	protected $validLocales = [];
162
-
163
-	/**
164
-	 * Constructor: Create new the Request class.
165
-	 * 
166
-	 * @param  array  $request
167
-	 * @param  array  $cookies
168
-	 * @param  array  $files
169
-	 * @param  array  $server
170
-	 * @param  string|resource|null $content  
171
-	 * 
172
-	 * @return void
173
-	 */
174
-	public function __construct(array $request = [], array $cookies = [], array $files = [], array $server = [], $content = null)
175
-	{
176
-		static::$requestURI = $this;
107
+    /** 
108
+     * The method name.
109
+     * 
110
+     * @var string $method
111
+     */
112
+    protected $method;
113
+
114
+    /**
115
+     * The path info of URL.
116
+     * 
117
+     * @var string $pathInfo
118
+     */
119
+    protected $pathInfo;
120
+
121
+    /**
122
+     * Request body parameters ($_POST).
123
+     * 
124
+     * @var \Syscodes\Http\Contributors\Parameters $request
125
+     */
126
+    public $request;
127
+
128
+    /**
129
+     * Get request URI.
130
+     * 
131
+     * @var string $requestToURI
132
+     */
133
+    protected $requestToURI;
134
+
135
+    /**
136
+     * Get the route resolver callback.
137
+     * 
138
+     * @var \Closure $routeResolver
139
+     */
140
+    protected $routeResolver;
141
+
142
+    /**
143
+     * The detected uri and server variables ($_FILES).
144
+     * 
145
+     * @var array $server
146
+     */
147
+    public $server = [];
148
+
149
+    /** 
150
+     * List of routes uri.
151
+     *
152
+     * @var string|array $uri 
153
+     */
154
+    public $uri;
155
+
156
+    /**
157
+     * Stores the valid locale codes.
158
+     * 
159
+     * @var array $validLocales
160
+     */
161
+    protected $validLocales = [];
162
+
163
+    /**
164
+     * Constructor: Create new the Request class.
165
+     * 
166
+     * @param  array  $request
167
+     * @param  array  $cookies
168
+     * @param  array  $files
169
+     * @param  array  $server
170
+     * @param  string|resource|null $content  
171
+     * 
172
+     * @return void
173
+     */
174
+    public function __construct(array $request = [], array $cookies = [], array $files = [], array $server = [], $content = null)
175
+    {
176
+        static::$requestURI = $this;
177 177
 		
178
-		$this->initialize($request, $cookies, $files, $server, $content);
179
-
180
-		$this->detectURI(config('app.uriProtocol'), config('app.baseUrl'));
181
-
182
-		$this->detectLocale();
183
-	}
184
-
185
-	/**
186
-	 * Sets the parameters for this request.
187
-	 * 
188
-	 * @param  array  $request
189
-	 * @param  array  $cookies
190
-	 * @param  array  $files
191
-	 * @param  array  $server
192
-	 * 
193
-	 * @return void
194
-	 */
195
-	public function initialize(array $request = [], array $cookies = [], array $files = [], array $server = [], $content = null)
196
-	{
197
-		$this->request      = new Parameters($request);
198
-		$this->cookies      = new Inputs($cookies);
199
-		$this->files        = new Files($files);
200
-		$this->server       = new Server($server);
201
-		$this->headers      = new Headers($this->server->all());
202
-
203
-		$this->uri          = new URI;
204
-		$this->http         = new Http;
205
-		$this->method       = null;
206
-		$this->baseUrl      = null;
207
-		$this->content      = $content;
208
-		$this->pathInfo     = null;
209
-		$this->languages    = null;
210
-		$this->validLocales = config('app.supportedLocales');
211
-	}
212
-
213
-	/**
214
-	 * Create a new Syscodes HTTP request from server variables.
215
-	 * 
216
-	 * @return static
217
-	 */
218
-	public static function capture()
219
-	{
220
-		return static::createFromRequest(static::createFromRequestGlobals());
221
-	}
222
-
223
-	/**
224
-	 * Creates an Syscodes request from of the Request class instance.
225
-	 * 
226
-	 * @param  \Syscodes\Http\Request  $request
227
-	 * 
228
-	 * @return static
229
-	 */
230
-	public static function createFromRequest($request)
231
-	{
232
-		$newRequest = (new static)->duplicate(
233
-			$request->request->all(), $request->cookies->all(), 
234
-			$request->files->all(), $request->server->all()
235
-		);
236
-
237
-		$newRequest->content = $request->content;
238
-
239
-		return $newRequest;
240
-	}
241
-
242
-	/**
243
-	 * Creates a new request with value from PHP's super global.
244
-	 * 
245
-	 * @return static
246
-	 */
247
-	public static function createFromRequestGlobals()
248
-	{
249
-		$request = static::createFromRequestFactory($_POST, $_COOKIE, $_FILES, $_SERVER);
250
-
251
-		return $request;
252
-	}
253
-
254
-	/**
255
-	 * Creates a new request from a factory.
256
-	 * 
257
-	 * @param  array  $request
258
-	 * @param  array  $cookies
259
-	 * @param  array  $files
260
-	 * @param  array  $server
261
-	 * 
262
-	 * @return static
263
-	 */
264
-	protected static function createFromRequestFactory(array $request = [], array $cookies = [], array $files = [], array $server = [])
265
-	{
266
-		if (self::$requestURI) {
267
-			$request = (self::$requestURI)($request, $cookies, $files, $server);
268
-
269
-			if ( ! $request instanceof self) {
270
-				throw new LogicException('The Request active must return an instance of Syscodes\Http\Request');
271
-			}
272
-
273
-			return $request;
274
-		}
275
-
276
-		return new static($request, $cookies, $files, $server);
277
-	}
278
-
279
-	/**
280
-	 * Clones a request and overrides some of its parameters.
281
-	 * 
282
-	 * @param  array  $request
283
-	 * @param  array  $cookies
284
-	 * @param  array  $files
285
-	 * @param  array  $server
286
-	 * 
287
-	 * @return static
288
-	 */
289
-	public function duplicate(array $request = [], array $cookies = [], array $files = [], array $server = [])
290
-	{
291
-		$duplicate = clone $this;
292
-
293
-		if (null !== $request) {
294
-			$duplicate->request = new Parameters($request);
295
-		}
296
-
297
-		if (null !== $cookies) {
298
-			$duplicate->cookies = new Inputs($cookies);
299
-		}
300
-
301
-		if (null !== $files) {
302
-			$duplicate->files = new Files($files);
303
-		}
304
-
305
-		if (null !== $server) {
306
-			$duplicate->server  = new Server($server);
307
-			$duplicate->headers = new Headers($duplicate->server->all());
308
-		}
309
-
310
-		$duplicate->uri          = new URI;
311
-		$duplicate->http         = new Http;
312
-		$duplicate->locale       = null;
313
-		$duplicate->method       = null;
314
-		$duplicate->baseUrl      = null;
315
-		$duplicate->pathInfo     = null;
316
-		$duplicate->validLocales = config('app.supportedLocales');
317
-
318
-		return $duplicate;		
319
-	}
320
-
321
-	/**
322
-	 * Returns the active request currently being used.
323
-	 *
324
-	 * @param  \Syscodes\Http\Request|bool|null  $request  Overwrite current request 
325
-	 *                                                     before returning, false prevents 
326
-	 *                                                     overwrite
327
-	 *
328
-	 * @return \Syscodes\Http\Request
329
-	 */
330
-	public static function active($request = false)
331
-	{
332
-		if ($request !== false) {
333
-			static::$requestURI = $request;
334
-		}
335
-
336
-		return static::$requestURI;
337
-	}
338
-
339
-	/**
340
-	 * Returns the desired segment, or $default if it does not exist.
341
-	 *
342
-	 * @param  int  $index  The segment number (1-based index)
343
-	 * @param  mixed  $default  Default value to return
344
-	 *
345
-	 * @return  string
346
-	 */
347
-	public function segment($index, $default = null)
348
-	{
349
-		if ($request = static::active()) {
350
-			return $request->uri->getSegment($index, $default);
351
-		}
352
-
353
-		return null;
354
-	}
355
-
356
-	/**
357
-	 * Returns all segments in an array. For total of segments
358
-	 * used the function PHP count().
359
-	 *
360
-	 * @return array
361
-	 */
362
-	public function segments()
363
-	{
364
-		if ($request = static::active()) {
365
-			return $request->uri->getSegments();
366
-		}
367
-
368
-		return null;
369
-	}
370
-
371
-	/**
372
-	 * Returns the total number of segment.
373
-	 *
374
-	 * @return int|null  
375
-	 */
376
-	public function totalSegments()
377
-	{
378
-		if ($request = static::active()) {
379
-			return $request->uri->getTotalSegments();
380
-		}
381
-
382
-		return null;
383
-	}
384
-
385
-	/**
386
-	 * Detects and returns the current URI based on a number of different server variables.
387
-	 * 
388
-	 * @param  string  $protocol
389
-	 * @param  string  $baseUrl
390
-	 * 
391
-	 * @return string
392
-	 */
393
-	protected function detectURI(string $protocol, string $baseUrl)
394
-	{
395
-		$this->uri->setPath($this->http->detectPath($protocol));
396
-
397
-		$baseUrl = ! empty($baseUrl) ? rtrim($baseUrl, '/ ').'/' : $baseUrl;
398
-
399
-		if ( ! empty($baseUrl)) {
400
-			$this->uri->setScheme(parse_url($baseUrl, PHP_URL_SCHEME));
401
-			$this->uri->setHost(parse_url($baseUrl, PHP_URL_HOST));
402
-			$this->uri->setPort(parse_url($baseUrl, PHP_URL_PORT));
403
-		} else {
404
-			if ( ! $this->http->isCli()) {
405
-				exit('You have an empty or invalid base URL. The baseURL value must be set in config/app.php, or through the .env file.');
406
-			}
407
-		}
408
-	}
409
-
410
-	/**
411
-	 * Handles setting up the locale, auto-detecting of language.
412
-	 * 
413
-	 * @return void
414
-	 */
415
-	public function detectLocale()
416
-	{
417
-		$this->languages = $this->defaultLocale = config('app.locale');
418
-
419
-		$this->setLocale($this->validLocales);
420
-	}
421
-
422
-	/**
423
-	 * Returns the default locale as set.
424
-	 * 
425
-	 * @return string
426
-	 */
427
-	public function getDefaultLocale()
428
-	{
429
-		return $this->defaultLocale;
430
-	}
431
-
432
-	/**
433
-	 * Gets the current locale, with a fallback to the default.
434
-	 * 
435
-	 * @return string 
436
-	 */
437
-	public function getLocale()
438
-	{
439
-		return $this->languages ?: $this->defaultLocale;
440
-	}
441
-
442
-	/**
443
-	 * Sets the locale string for this request.
444
-	 * 
445
-	 * @param  string  $locale
446
-	 * 
447
-	 * @return \Syscodes\Http\Request
448
-	 */
449
-	public function setLocale($locale)
450
-	{
451
-		if ( ! in_array($locale, $this->validLocales)) {
452
-			$locale = $this->defaultLocale;
453
-		}
178
+        $this->initialize($request, $cookies, $files, $server, $content);
179
+
180
+        $this->detectURI(config('app.uriProtocol'), config('app.baseUrl'));
181
+
182
+        $this->detectLocale();
183
+    }
184
+
185
+    /**
186
+     * Sets the parameters for this request.
187
+     * 
188
+     * @param  array  $request
189
+     * @param  array  $cookies
190
+     * @param  array  $files
191
+     * @param  array  $server
192
+     * 
193
+     * @return void
194
+     */
195
+    public function initialize(array $request = [], array $cookies = [], array $files = [], array $server = [], $content = null)
196
+    {
197
+        $this->request      = new Parameters($request);
198
+        $this->cookies      = new Inputs($cookies);
199
+        $this->files        = new Files($files);
200
+        $this->server       = new Server($server);
201
+        $this->headers      = new Headers($this->server->all());
202
+
203
+        $this->uri          = new URI;
204
+        $this->http         = new Http;
205
+        $this->method       = null;
206
+        $this->baseUrl      = null;
207
+        $this->content      = $content;
208
+        $this->pathInfo     = null;
209
+        $this->languages    = null;
210
+        $this->validLocales = config('app.supportedLocales');
211
+    }
212
+
213
+    /**
214
+     * Create a new Syscodes HTTP request from server variables.
215
+     * 
216
+     * @return static
217
+     */
218
+    public static function capture()
219
+    {
220
+        return static::createFromRequest(static::createFromRequestGlobals());
221
+    }
222
+
223
+    /**
224
+     * Creates an Syscodes request from of the Request class instance.
225
+     * 
226
+     * @param  \Syscodes\Http\Request  $request
227
+     * 
228
+     * @return static
229
+     */
230
+    public static function createFromRequest($request)
231
+    {
232
+        $newRequest = (new static)->duplicate(
233
+            $request->request->all(), $request->cookies->all(), 
234
+            $request->files->all(), $request->server->all()
235
+        );
236
+
237
+        $newRequest->content = $request->content;
238
+
239
+        return $newRequest;
240
+    }
241
+
242
+    /**
243
+     * Creates a new request with value from PHP's super global.
244
+     * 
245
+     * @return static
246
+     */
247
+    public static function createFromRequestGlobals()
248
+    {
249
+        $request = static::createFromRequestFactory($_POST, $_COOKIE, $_FILES, $_SERVER);
250
+
251
+        return $request;
252
+    }
253
+
254
+    /**
255
+     * Creates a new request from a factory.
256
+     * 
257
+     * @param  array  $request
258
+     * @param  array  $cookies
259
+     * @param  array  $files
260
+     * @param  array  $server
261
+     * 
262
+     * @return static
263
+     */
264
+    protected static function createFromRequestFactory(array $request = [], array $cookies = [], array $files = [], array $server = [])
265
+    {
266
+        if (self::$requestURI) {
267
+            $request = (self::$requestURI)($request, $cookies, $files, $server);
268
+
269
+            if ( ! $request instanceof self) {
270
+                throw new LogicException('The Request active must return an instance of Syscodes\Http\Request');
271
+            }
272
+
273
+            return $request;
274
+        }
275
+
276
+        return new static($request, $cookies, $files, $server);
277
+    }
278
+
279
+    /**
280
+     * Clones a request and overrides some of its parameters.
281
+     * 
282
+     * @param  array  $request
283
+     * @param  array  $cookies
284
+     * @param  array  $files
285
+     * @param  array  $server
286
+     * 
287
+     * @return static
288
+     */
289
+    public function duplicate(array $request = [], array $cookies = [], array $files = [], array $server = [])
290
+    {
291
+        $duplicate = clone $this;
292
+
293
+        if (null !== $request) {
294
+            $duplicate->request = new Parameters($request);
295
+        }
296
+
297
+        if (null !== $cookies) {
298
+            $duplicate->cookies = new Inputs($cookies);
299
+        }
300
+
301
+        if (null !== $files) {
302
+            $duplicate->files = new Files($files);
303
+        }
304
+
305
+        if (null !== $server) {
306
+            $duplicate->server  = new Server($server);
307
+            $duplicate->headers = new Headers($duplicate->server->all());
308
+        }
309
+
310
+        $duplicate->uri          = new URI;
311
+        $duplicate->http         = new Http;
312
+        $duplicate->locale       = null;
313
+        $duplicate->method       = null;
314
+        $duplicate->baseUrl      = null;
315
+        $duplicate->pathInfo     = null;
316
+        $duplicate->validLocales = config('app.supportedLocales');
317
+
318
+        return $duplicate;		
319
+    }
320
+
321
+    /**
322
+     * Returns the active request currently being used.
323
+     *
324
+     * @param  \Syscodes\Http\Request|bool|null  $request  Overwrite current request 
325
+     *                                                     before returning, false prevents 
326
+     *                                                     overwrite
327
+     *
328
+     * @return \Syscodes\Http\Request
329
+     */
330
+    public static function active($request = false)
331
+    {
332
+        if ($request !== false) {
333
+            static::$requestURI = $request;
334
+        }
335
+
336
+        return static::$requestURI;
337
+    }
338
+
339
+    /**
340
+     * Returns the desired segment, or $default if it does not exist.
341
+     *
342
+     * @param  int  $index  The segment number (1-based index)
343
+     * @param  mixed  $default  Default value to return
344
+     *
345
+     * @return  string
346
+     */
347
+    public function segment($index, $default = null)
348
+    {
349
+        if ($request = static::active()) {
350
+            return $request->uri->getSegment($index, $default);
351
+        }
352
+
353
+        return null;
354
+    }
355
+
356
+    /**
357
+     * Returns all segments in an array. For total of segments
358
+     * used the function PHP count().
359
+     *
360
+     * @return array
361
+     */
362
+    public function segments()
363
+    {
364
+        if ($request = static::active()) {
365
+            return $request->uri->getSegments();
366
+        }
367
+
368
+        return null;
369
+    }
370
+
371
+    /**
372
+     * Returns the total number of segment.
373
+     *
374
+     * @return int|null  
375
+     */
376
+    public function totalSegments()
377
+    {
378
+        if ($request = static::active()) {
379
+            return $request->uri->getTotalSegments();
380
+        }
381
+
382
+        return null;
383
+    }
384
+
385
+    /**
386
+     * Detects and returns the current URI based on a number of different server variables.
387
+     * 
388
+     * @param  string  $protocol
389
+     * @param  string  $baseUrl
390
+     * 
391
+     * @return string
392
+     */
393
+    protected function detectURI(string $protocol, string $baseUrl)
394
+    {
395
+        $this->uri->setPath($this->http->detectPath($protocol));
396
+
397
+        $baseUrl = ! empty($baseUrl) ? rtrim($baseUrl, '/ ').'/' : $baseUrl;
398
+
399
+        if ( ! empty($baseUrl)) {
400
+            $this->uri->setScheme(parse_url($baseUrl, PHP_URL_SCHEME));
401
+            $this->uri->setHost(parse_url($baseUrl, PHP_URL_HOST));
402
+            $this->uri->setPort(parse_url($baseUrl, PHP_URL_PORT));
403
+        } else {
404
+            if ( ! $this->http->isCli()) {
405
+                exit('You have an empty or invalid base URL. The baseURL value must be set in config/app.php, or through the .env file.');
406
+            }
407
+        }
408
+    }
409
+
410
+    /**
411
+     * Handles setting up the locale, auto-detecting of language.
412
+     * 
413
+     * @return void
414
+     */
415
+    public function detectLocale()
416
+    {
417
+        $this->languages = $this->defaultLocale = config('app.locale');
418
+
419
+        $this->setLocale($this->validLocales);
420
+    }
421
+
422
+    /**
423
+     * Returns the default locale as set.
424
+     * 
425
+     * @return string
426
+     */
427
+    public function getDefaultLocale()
428
+    {
429
+        return $this->defaultLocale;
430
+    }
431
+
432
+    /**
433
+     * Gets the current locale, with a fallback to the default.
434
+     * 
435
+     * @return string 
436
+     */
437
+    public function getLocale()
438
+    {
439
+        return $this->languages ?: $this->defaultLocale;
440
+    }
441
+
442
+    /**
443
+     * Sets the locale string for this request.
444
+     * 
445
+     * @param  string  $locale
446
+     * 
447
+     * @return \Syscodes\Http\Request
448
+     */
449
+    public function setLocale($locale)
450
+    {
451
+        if ( ! in_array($locale, $this->validLocales)) {
452
+            $locale = $this->defaultLocale;
453
+        }
454 454
 		
455
-		$this->languages = $locale;
456
-
457
-		try {
458
-		    if (class_exists('Locale', false)) {
459
-				Locale::setDefault($locale);
460
-			}
461
-		} catch (Exception $exception) {}
462
-
463
-		return $this;
464
-	}
465
-
466
-	/**
467
-	 * Returns the full request string.
468
-	 *
469
-	 * @return string|null  The Request string
470
-	 */
471
-	public function get() 
472
-	{
473
-		if ($request = static::active()) {
474
-			return $request->uri->get();
475
-		}
476
-
477
-		return null;
478
-	}
479
-
480
-	/**
481
-	 * Get the JSON payload for the request.
482
-	 * 
483
-	 * @param  string|null  $key  
484
-	 * @param  mixed  $default  
485
-	 * 
486
-	 * @return \Syscodes\Http\Contributors\Parameters|mixed
487
-	 */
488
-	public function json($key = null, $default = null)
489
-	{
490
-		if ( ! isset($this->json)) {
491
-			$this->json = new Parameters((array) json_decode($this->getContent(), true));
492
-		}
493
-
494
-		if (is_null($key)) {
495
-			return $this->json;
496
-		}
497
-
498
-		return Arr::get($this->json->all(), $key, $default);
499
-	}
500
-
501
-	/**
502
-	 * Set the JSON payload for the request
503
-	 * 
504
-	 * @param  \Syscodes\Http\Contributors\Parameters  $json
505
-	 * 
506
-	 * @return $this
507
-	 */
508
-	public function setJson($json)
509
-	{
510
-		$this->json = $json;
511
-
512
-		return $this;
513
-	}
514
-
515
-	/**
516
-	 * Returns whether this is an AJAX request or not.
517
-	 *
518
-	 * @return bool
519
-	 */
520
-	public function isXmlHttpRequest()
521
-	{
522
-		return ! empty($this->server->get('HTTP_X_REQUESTED_WITH')) && 
523
-				strtolower($this->server->get('HTTP_X_REQUESTED_WITH')) === 'xmlhttprequest';
524
-	}
525
-
526
-	/**
527
-	 * Returns the input method used (GET, POST, DELETE, etc.).
528
-	 *
529
-	 * @return string
530
-	 * 
531
-	 * @throws \LogicException  
532
-	 */
533
-	public function getmethod()
534
-	{
535
-		if (null !== $this->method) {
536
-			return $this->method;
537
-		}
455
+        $this->languages = $locale;
456
+
457
+        try {
458
+            if (class_exists('Locale', false)) {
459
+                Locale::setDefault($locale);
460
+            }
461
+        } catch (Exception $exception) {}
462
+
463
+        return $this;
464
+    }
465
+
466
+    /**
467
+     * Returns the full request string.
468
+     *
469
+     * @return string|null  The Request string
470
+     */
471
+    public function get() 
472
+    {
473
+        if ($request = static::active()) {
474
+            return $request->uri->get();
475
+        }
476
+
477
+        return null;
478
+    }
479
+
480
+    /**
481
+     * Get the JSON payload for the request.
482
+     * 
483
+     * @param  string|null  $key  
484
+     * @param  mixed  $default  
485
+     * 
486
+     * @return \Syscodes\Http\Contributors\Parameters|mixed
487
+     */
488
+    public function json($key = null, $default = null)
489
+    {
490
+        if ( ! isset($this->json)) {
491
+            $this->json = new Parameters((array) json_decode($this->getContent(), true));
492
+        }
493
+
494
+        if (is_null($key)) {
495
+            return $this->json;
496
+        }
497
+
498
+        return Arr::get($this->json->all(), $key, $default);
499
+    }
500
+
501
+    /**
502
+     * Set the JSON payload for the request
503
+     * 
504
+     * @param  \Syscodes\Http\Contributors\Parameters  $json
505
+     * 
506
+     * @return $this
507
+     */
508
+    public function setJson($json)
509
+    {
510
+        $this->json = $json;
511
+
512
+        return $this;
513
+    }
514
+
515
+    /**
516
+     * Returns whether this is an AJAX request or not.
517
+     *
518
+     * @return bool
519
+     */
520
+    public function isXmlHttpRequest()
521
+    {
522
+        return ! empty($this->server->get('HTTP_X_REQUESTED_WITH')) && 
523
+                strtolower($this->server->get('HTTP_X_REQUESTED_WITH')) === 'xmlhttprequest';
524
+    }
525
+
526
+    /**
527
+     * Returns the input method used (GET, POST, DELETE, etc.).
528
+     *
529
+     * @return string
530
+     * 
531
+     * @throws \LogicException  
532
+     */
533
+    public function getmethod()
534
+    {
535
+        if (null !== $this->method) {
536
+            return $this->method;
537
+        }
538 538
 		
539
-		$method = strtoupper($this->server->get('REQUEST_METHOD', 'GET'));
539
+        $method = strtoupper($this->server->get('REQUEST_METHOD', 'GET'));
540 540
 		
541
-		if (in_array($method, ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'PATCH', 'PURGE', 'TRACE'], true)) {
542
-			return $this->method = $method;
543
-		}
541
+        if (in_array($method, ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'PATCH', 'PURGE', 'TRACE'], true)) {
542
+            return $this->method = $method;
543
+        }
544 544
 		
545
-		if ( ! preg_match('~^[A-Z]++$#~D', $method)) {
546
-			throw new logicException(sprintf('Invalid method override "%s"', $method));
547
-		}
548
-
549
-		return $this->method = $method;
550
-	}
551
-
552
-	/**
553
-	 * Sets the request method.
554
-	 *
555
-	 * @param  string  $method  
556
-	 *
557
-	 * @return string
558
-	 */
559
-	public function setMethod(string $method) 
560
-	{
561
-		$this->method = null;
562
-
563
-		$this->server->set('REQUEST_METHOD', $method);
564
-	}
545
+        if ( ! preg_match('~^[A-Z]++$#~D', $method)) {
546
+            throw new logicException(sprintf('Invalid method override "%s"', $method));
547
+        }
548
+
549
+        return $this->method = $method;
550
+    }
551
+
552
+    /**
553
+     * Sets the request method.
554
+     *
555
+     * @param  string  $method  
556
+     *
557
+     * @return string
558
+     */
559
+    public function setMethod(string $method) 
560
+    {
561
+        $this->method = null;
562
+
563
+        $this->server->set('REQUEST_METHOD', $method);
564
+    }
565 565
 	
566
-	/**
567
-	 * Determine if the current request URI matches a pattern.
568
-	 * 
569
-	 * @param  mixed  ...$patterns
570
-	 * 
571
-	 * @return bool
572
-	 */
573
-	public function is(...$patterns)
574
-	{
575
-		$path = $this->decodedPath();
566
+    /**
567
+     * Determine if the current request URI matches a pattern.
568
+     * 
569
+     * @param  mixed  ...$patterns
570
+     * 
571
+     * @return bool
572
+     */
573
+    public function is(...$patterns)
574
+    {
575
+        $path = $this->decodedPath();
576 576
 		
577
-		foreach ($patterns as $pattern) {
578
-			if (Str::is($pattern, $path)) {
579
-				return true;
580
-			}
581
-		}
582
-
583
-		return false;
584
-	}
585
-
586
-	/**
587
-	 * Determine if the route name matches a given pattern.
588
-	 * 
589
-	 * @param  mixed  ...$patterns
590
-	 * 
591
-	 * @return bool
592
-	 */
593
-	public function routeIs(...$patterns)
594
-	{
595
-		return $this->route() && $this->route()->is(...$patterns);
596
-	}
597
-
598
-	/**
599
-	 * Get the route handling the request.
600
-	 * 
601
-	 * @param  string|null  $param  
602
-	 * @param  mixed  $default  
603
-	 * 
604
-	 * @return \Syscodes\Routing\Route|object|string|null
605
-	 */
606
-	public function route($param = null, $default = null)
607
-	{
608
-		$route = call_user_func($this->getRouteResolver());
609
-
610
-		if (is_null($route) || is_null($param)) {
611
-			return $route;
612
-		}
613
-
614
-		return $route->parameter($param, $default);
615
-	}
616
-
617
-	/**
618
-	 * Get the current decoded path info for the request.
619
-	 * 
620
-	 * @return string
621
-	 */
622
-	public function decodedPath()
623
-	{
624
-		return rawurldecode($this->path());
625
-	}
626
-
627
-	/**
628
-	 * Get the current path info for the request.
629
-	 * 
630
-	 * @return string
631
-	 */
632
-	public function path()
633
-	{
634
-		$path = trim($this->getPathInfo(), '/');
635
-
636
-		return $path == '' ? '/' : $path;
637
-	}
638
-
639
-	/**
640
-	 * Retunrs the request body content.
641
-	 * 
642
-	 * @return string
643
-	 */
644
-	public function getContent()
645
-	{
646
-		if (null === $this->content || false === $this->content)
647
-		{
648
-			$this->content = file_get_contents('php://input');
649
-		}
650
-
651
-		return $this->content;
652
-	}
653
-
654
-	/**
655
-	 * Returns the path being requested relative to the executed script. 
656
-	 * 
657
-	 * @return string
658
-	 */
659
-	public function getPathInfo()
660
-	{
661
-		if (null === $this->pathInfo)
662
-		{
663
-			$this->pathInfo = $this->http->parsePathInfo();
664
-		}
665
-
666
-		return $this->pathInfo;
667
-	}
668
-
669
-	/**
670
-	 * Returns the root URL from which this request is executed.
671
-	 * 
672
-	 * @return string
673
-	 */
674
-	public function getBaseUrl()
675
-	{
676
-		if (null === $this->baseUrl)
677
-		{
678
-			$this->baseUrl = $this->http->parseBaseUrl();
679
-		}
680
-
681
-		return $this->baseUrl;
682
-	}
683
-
684
-	/**
685
-	 * Returns the requested URI.
686
-	 * 
687
-	 * @return string
688
-	 */
689
-	public function getRequestUri()
690
-	{
691
-		if (null === $this->requestToUri) {
692
-			$this->requestToUri = $this->http->parseRequestUri();
693
-		}
694
-
695
-		return $this->requestToUri;
696
-	}
577
+        foreach ($patterns as $pattern) {
578
+            if (Str::is($pattern, $path)) {
579
+                return true;
580
+            }
581
+        }
582
+
583
+        return false;
584
+    }
585
+
586
+    /**
587
+     * Determine if the route name matches a given pattern.
588
+     * 
589
+     * @param  mixed  ...$patterns
590
+     * 
591
+     * @return bool
592
+     */
593
+    public function routeIs(...$patterns)
594
+    {
595
+        return $this->route() && $this->route()->is(...$patterns);
596
+    }
597
+
598
+    /**
599
+     * Get the route handling the request.
600
+     * 
601
+     * @param  string|null  $param  
602
+     * @param  mixed  $default  
603
+     * 
604
+     * @return \Syscodes\Routing\Route|object|string|null
605
+     */
606
+    public function route($param = null, $default = null)
607
+    {
608
+        $route = call_user_func($this->getRouteResolver());
609
+
610
+        if (is_null($route) || is_null($param)) {
611
+            return $route;
612
+        }
613
+
614
+        return $route->parameter($param, $default);
615
+    }
616
+
617
+    /**
618
+     * Get the current decoded path info for the request.
619
+     * 
620
+     * @return string
621
+     */
622
+    public function decodedPath()
623
+    {
624
+        return rawurldecode($this->path());
625
+    }
626
+
627
+    /**
628
+     * Get the current path info for the request.
629
+     * 
630
+     * @return string
631
+     */
632
+    public function path()
633
+    {
634
+        $path = trim($this->getPathInfo(), '/');
635
+
636
+        return $path == '' ? '/' : $path;
637
+    }
638
+
639
+    /**
640
+     * Retunrs the request body content.
641
+     * 
642
+     * @return string
643
+     */
644
+    public function getContent()
645
+    {
646
+        if (null === $this->content || false === $this->content)
647
+        {
648
+            $this->content = file_get_contents('php://input');
649
+        }
650
+
651
+        return $this->content;
652
+    }
653
+
654
+    /**
655
+     * Returns the path being requested relative to the executed script. 
656
+     * 
657
+     * @return string
658
+     */
659
+    public function getPathInfo()
660
+    {
661
+        if (null === $this->pathInfo)
662
+        {
663
+            $this->pathInfo = $this->http->parsePathInfo();
664
+        }
665
+
666
+        return $this->pathInfo;
667
+    }
668
+
669
+    /**
670
+     * Returns the root URL from which this request is executed.
671
+     * 
672
+     * @return string
673
+     */
674
+    public function getBaseUrl()
675
+    {
676
+        if (null === $this->baseUrl)
677
+        {
678
+            $this->baseUrl = $this->http->parseBaseUrl();
679
+        }
680
+
681
+        return $this->baseUrl;
682
+    }
683
+
684
+    /**
685
+     * Returns the requested URI.
686
+     * 
687
+     * @return string
688
+     */
689
+    public function getRequestUri()
690
+    {
691
+        if (null === $this->requestToUri) {
692
+            $this->requestToUri = $this->http->parseRequestUri();
693
+        }
694
+
695
+        return $this->requestToUri;
696
+    }
697 697
 	
698
-	/**
699
-	 * Gets the request's scheme.
700
-	 * 
701
-	 * @return string
702
-	 */
703
-	public function getScheme()
704
-	{
705
-		return $this->secure() ? $this->uri->setScheme('https') : $this->uri->setScheme('http');
706
-	}
707
-
708
-	/**
709
-	 * Returns the host name.
710
-	 * 
711
-	 * @return void
712
-	 */
713
-	public function getHost()
714
-	{
715
-		if ($forwardedHost = $this->server->get('HTTP_X_FORWARDED_HOST')) {
716
-			$host = $forawardedHost[0];
717
-		} elseif ( ! $host = $this->headers->get('HOST')) {
718
-			if ( ! $host = $this->server->get('SERVER_NAME')) {
719
-				$host = $this->server->get('REMOTE_ADDR', '');
720
-			}
721
-		}
722
-
723
-		$host = $_SERVER['SERVER_NAME'];
724
-
725
-		$host = strtolower(preg_replace('/:\d+$/', '', trim(($host))));
698
+    /**
699
+     * Gets the request's scheme.
700
+     * 
701
+     * @return string
702
+     */
703
+    public function getScheme()
704
+    {
705
+        return $this->secure() ? $this->uri->setScheme('https') : $this->uri->setScheme('http');
706
+    }
707
+
708
+    /**
709
+     * Returns the host name.
710
+     * 
711
+     * @return void
712
+     */
713
+    public function getHost()
714
+    {
715
+        if ($forwardedHost = $this->server->get('HTTP_X_FORWARDED_HOST')) {
716
+            $host = $forawardedHost[0];
717
+        } elseif ( ! $host = $this->headers->get('HOST')) {
718
+            if ( ! $host = $this->server->get('SERVER_NAME')) {
719
+                $host = $this->server->get('REMOTE_ADDR', '');
720
+            }
721
+        }
722
+
723
+        $host = $_SERVER['SERVER_NAME'];
724
+
725
+        $host = strtolower(preg_replace('/:\d+$/', '', trim(($host))));
726 726
 		
727
-		return $host;
728
-	}
729
-
730
-	/**
731
-	 * Returns the port on which the request is made.
732
-	 * 
733
-	 * @return int
734
-	 */
735
-	public function getPort()
736
-	{
737
-		if ( ! $this->server->get('HTTP_HOST')) 
738
-		{
739
-			return $this->server->get('SERVER_PORT');
740
-		}
727
+        return $host;
728
+    }
729
+
730
+    /**
731
+     * Returns the port on which the request is made.
732
+     * 
733
+     * @return int
734
+     */
735
+    public function getPort()
736
+    {
737
+        if ( ! $this->server->get('HTTP_HOST')) 
738
+        {
739
+            return $this->server->get('SERVER_PORT');
740
+        }
741 741
 		
742
-		return 'https' === $this->getScheme() ? $this->uri->setPort(443) : $this->uri->setPort(80);
743
-	}
744
-
745
-	/**
746
-	 * Returns the HTTP host being requested.
747
-	 * 
748
-	 * @return string
749
-	 */
750
-	public function getHttpHost()
751
-	{
752
-		$scheme = $this->getScheme();
753
-		$port   = $this->getPort();
754
-
755
-		if (('http' === $scheme && 80 === $port) || ('https' === $scheme && 443 === $port))		
756
-		{
757
-			return $this->getHost();
758
-		}
759
-
760
-		return $this->getHost().':'.$port;
761
-	}
762
-
763
-	/**
764
-	 * Gets the scheme and HTTP host.
765
-	 * 
766
-	 * @return string
767
-	 */
768
-	public function getSchemeWithHttpHost()
769
-	{
770
-		return $this->getScheme().'://'.$this->getHttpHost();
771
-	}
772
-
773
-	/**
774
-	 * Get the root URL for the application.
775
-	 * 
776
-	 * @return string
777
-	 */
778
-	public function root()
779
-	{
780
-		return rtrim($this->getSchemeWithHttpHost().$this->getBaseUrl(), '/');
781
-	}
782
-
783
-	/**
784
-	 * Get the URL for the request.
785
-	 * 
786
-	 * @return string
787
-	 */
788
-	public function url()
789
-	{
790
-		return trim(preg_replace('/\?.*/', '', $this->get()), '/');
791
-	}
792
-
793
-	/**
794
-	 * Returns the referer.
795
-	 * 
796
-	 * @param  string  $default
797
-	 * 
798
-	 * @return string
799
-	 */
800
-	public function referer(string $default = '')
801
-	{
802
-		return $this->server->get('HTTP_REFERER', $default);
803
-	}
742
+        return 'https' === $this->getScheme() ? $this->uri->setPort(443) : $this->uri->setPort(80);
743
+    }
744
+
745
+    /**
746
+     * Returns the HTTP host being requested.
747
+     * 
748
+     * @return string
749
+     */
750
+    public function getHttpHost()
751
+    {
752
+        $scheme = $this->getScheme();
753
+        $port   = $this->getPort();
754
+
755
+        if (('http' === $scheme && 80 === $port) || ('https' === $scheme && 443 === $port))		
756
+        {
757
+            return $this->getHost();
758
+        }
759
+
760
+        return $this->getHost().':'.$port;
761
+    }
762
+
763
+    /**
764
+     * Gets the scheme and HTTP host.
765
+     * 
766
+     * @return string
767
+     */
768
+    public function getSchemeWithHttpHost()
769
+    {
770
+        return $this->getScheme().'://'.$this->getHttpHost();
771
+    }
772
+
773
+    /**
774
+     * Get the root URL for the application.
775
+     * 
776
+     * @return string
777
+     */
778
+    public function root()
779
+    {
780
+        return rtrim($this->getSchemeWithHttpHost().$this->getBaseUrl(), '/');
781
+    }
782
+
783
+    /**
784
+     * Get the URL for the request.
785
+     * 
786
+     * @return string
787
+     */
788
+    public function url()
789
+    {
790
+        return trim(preg_replace('/\?.*/', '', $this->get()), '/');
791
+    }
792
+
793
+    /**
794
+     * Returns the referer.
795
+     * 
796
+     * @param  string  $default
797
+     * 
798
+     * @return string
799
+     */
800
+    public function referer(string $default = '')
801
+    {
802
+        return $this->server->get('HTTP_REFERER', $default);
803
+    }
804 804
 	
805
-	/**
806
-	 * Attempts to detect if the current connection is secure through 
807
-	 * over HTTPS protocol.
808
-	 * 
809
-	 * @return bool
810
-	 */
811
-	public function secure()
812
-	{
813
-		if ( ! empty($this->server->get('HTTPS')) && strtolower($this->server->get('HTTPS')) !== 'off') {
814
-			return true;
815
-		} elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $this->server->get('HTTP_X_FORWARDED_PROTO') === 'https') {
816
-			return true;
817
-		} elseif ( ! empty($this->server->get('HTTP_FRONT_END_HTTPS')) && strtolower($this->server->get('HTTP_FRONT_END_HTTPS')) !== 'off') {
818
-			return true;
819
-		}
820
-
821
-		return false;
822
-	}
823
-
824
-	/**
825
-	 * Returns the user agent.
826
-	 *
827
-	 * @param  string|null  $default
828
-	 *
829
-	 * @return string
830
-	 */
831
-	public function userAgent(string $default = null)
832
-	{
833
-		return $this->server->get('HTTP_USER_AGENT', $default);
834
-	}
835
-
836
-	/**
837
-	 * Get the route resolver callback.
838
-	 * 
839
-	 * @return \Closure
840
-	 */
841
-	public function getRouteResolver()
842
-	{
843
-		return $this->routeResolver ?: function () {
844
-			//
845
-		};
846
-	}
847
-
848
-	/**
849
-	 * Set the route resolver callback.
850
-	 * 
851
-	 * @param  \Closure  $callback
852
-	 * 
853
-	 * @return $this
854
-	 */
855
-	public function setRouteResolver(Closure $callback)
856
-	{
857
-		$this->routeResolver = $callback;
858
-
859
-		return $this;
860
-	}
861
-
862
-	/**
863
-	 * Get an element from the request.
864
-	 * 
865
-	 * @return string[]
866
-	 */
867
-	public function __get($key)
868
-	{
869
-		$all = $this->server->all();
870
-
871
-		if (array_key_exists($key, $all)) {
872
-			return $all[$key];
873
-		} else {
874
-			return $key;
875
-		}
876
-	}
877
-
878
-	/**
879
-	 * Returns the Request as an HTTP string.
880
-	 * 
881
-	 * @return string
882
-	 */
883
-	public function __toString()
884
-	{
885
-		try
886
-		{
887
-			$content = $this->getContent();
888
-		}
889
-		catch (LogicException $e)
890
-		{
891
-			if (PHP_VERSION_ID > 70400)
892
-			{
893
-				throw $e;
894
-			}
895
-
896
-			return trigger_error($e, E_USER_ERROR);
897
-		}
898
-
899
-		$cookieHeader = '';
900
-		$cookies      = [];
901
-
902
-		foreach ($this->cookies as $key => $value)
903
-		{
904
-			$cookies[]= "{$key} = {$value}";
905
-		}
906
-
907
-		if ( ! empty($cookies))
908
-		{
909
-			$cookieHeader = 'Cookie: '.implode('; ', $cookies)."\r\n";
910
-		}
805
+    /**
806
+     * Attempts to detect if the current connection is secure through 
807
+     * over HTTPS protocol.
808
+     * 
809
+     * @return bool
810
+     */
811
+    public function secure()
812
+    {
813
+        if ( ! empty($this->server->get('HTTPS')) && strtolower($this->server->get('HTTPS')) !== 'off') {
814
+            return true;
815
+        } elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $this->server->get('HTTP_X_FORWARDED_PROTO') === 'https') {
816
+            return true;
817
+        } elseif ( ! empty($this->server->get('HTTP_FRONT_END_HTTPS')) && strtolower($this->server->get('HTTP_FRONT_END_HTTPS')) !== 'off') {
818
+            return true;
819
+        }
820
+
821
+        return false;
822
+    }
823
+
824
+    /**
825
+     * Returns the user agent.
826
+     *
827
+     * @param  string|null  $default
828
+     *
829
+     * @return string
830
+     */
831
+    public function userAgent(string $default = null)
832
+    {
833
+        return $this->server->get('HTTP_USER_AGENT', $default);
834
+    }
835
+
836
+    /**
837
+     * Get the route resolver callback.
838
+     * 
839
+     * @return \Closure
840
+     */
841
+    public function getRouteResolver()
842
+    {
843
+        return $this->routeResolver ?: function () {
844
+            //
845
+        };
846
+    }
847
+
848
+    /**
849
+     * Set the route resolver callback.
850
+     * 
851
+     * @param  \Closure  $callback
852
+     * 
853
+     * @return $this
854
+     */
855
+    public function setRouteResolver(Closure $callback)
856
+    {
857
+        $this->routeResolver = $callback;
858
+
859
+        return $this;
860
+    }
861
+
862
+    /**
863
+     * Get an element from the request.
864
+     * 
865
+     * @return string[]
866
+     */
867
+    public function __get($key)
868
+    {
869
+        $all = $this->server->all();
870
+
871
+        if (array_key_exists($key, $all)) {
872
+            return $all[$key];
873
+        } else {
874
+            return $key;
875
+        }
876
+    }
877
+
878
+    /**
879
+     * Returns the Request as an HTTP string.
880
+     * 
881
+     * @return string
882
+     */
883
+    public function __toString()
884
+    {
885
+        try
886
+        {
887
+            $content = $this->getContent();
888
+        }
889
+        catch (LogicException $e)
890
+        {
891
+            if (PHP_VERSION_ID > 70400)
892
+            {
893
+                throw $e;
894
+            }
895
+
896
+            return trigger_error($e, E_USER_ERROR);
897
+        }
898
+
899
+        $cookieHeader = '';
900
+        $cookies      = [];
901
+
902
+        foreach ($this->cookies as $key => $value)
903
+        {
904
+            $cookies[]= "{$key} = {$value}";
905
+        }
906
+
907
+        if ( ! empty($cookies))
908
+        {
909
+            $cookieHeader = 'Cookie: '.implode('; ', $cookies)."\r\n";
910
+        }
911 911
 		
912
-		return sprintf('%s %s %s', $this->getMethod(), $this->getRequestUri(), $this->server->get('SERVER_PROTOCOL'))."\r\n".
913
-			$this->headers.
914
-			$cookieHeader."\r\n".
915
-			$content;
916
-	}
917
-
918
-	/**
919
-	 * Clones the current request.
920
-	 * 
921
-	 * @return void
922
-	 */
923
-	public function __clone()
924
-	{
925
-		$this->request = clone $this->request;
926
-		$this->cookies = clone $this->cookies;
927
-		$this->files   = clone $this->files;
928
-		$this->server  = clone $this->server;
929
-		$this->headers = clone $this->headers;
930
-	}
912
+        return sprintf('%s %s %s', $this->getMethod(), $this->getRequestUri(), $this->server->get('SERVER_PROTOCOL'))."\r\n".
913
+            $this->headers.
914
+            $cookieHeader."\r\n".
915
+            $content;
916
+    }
917
+
918
+    /**
919
+     * Clones the current request.
920
+     * 
921
+     * @return void
922
+     */
923
+    public function __clone()
924
+    {
925
+        $this->request = clone $this->request;
926
+        $this->cookies = clone $this->cookies;
927
+        $this->files   = clone $this->files;
928
+        $this->server  = clone $this->server;
929
+        $this->headers = clone $this->headers;
930
+    }
931 931
 }
932 932
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 	 */
841 841
 	public function getRouteResolver()
842 842
 	{
843
-		return $this->routeResolver ?: function () {
843
+		return $this->routeResolver ?: function() {
844 844
 			//
845 845
 		};
846 846
 	}
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 
902 902
 		foreach ($this->cookies as $key => $value)
903 903
 		{
904
-			$cookies[]= "{$key} = {$value}";
904
+			$cookies[] = "{$key} = {$value}";
905 905
 		}
906 906
 
907 907
 		if ( ! empty($cookies))
Please login to merge, or discard this patch.
src/components/Http/Http.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 			$protocol = 'REQUEST_URI';
114 114
 		}
115 115
 
116
-		switch($protocol) {
116
+		switch ($protocol) {
117 117
 			case 'REQUEST_URI':
118 118
 				$path = $this->parseRequestUri();
119 119
 				break;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 			$last    = count($segs);
240 240
 			$baseUrl = '';
241 241
 			
242
-			do 	{
242
+			do {
243 243
 				$seg     = $segs[$index];
244 244
 				$baseUrl = '/'.$seg.$baseUrl;
245 245
 				++$index;
Please login to merge, or discard this patch.
Indentation   +253 added lines, -253 removed lines patch added patch discarded remove patch
@@ -31,265 +31,265 @@
 block discarded – undo
31 31
  */
32 32
 class Http
33 33
 {
34
-	/**
35
-	 * Return's the protocol that the request was made with.
36
-	 *
37
-	 * @return string
38
-	 */
39
-	public function protocol()
40
-	{
41
-		if ($this->server('HTTPS') == 'on' ||
42
-			$this->server('HTTPS') == 1 ||
43
-			$this->server('SERVER_PORT') == 443 ||
44
-			(config('security.allow-x-headers', false) && $this->server('HTTP_X_FORWARDED_PROTO') == 'https') ||
45
-			(config('security.allow-x-headers', false) && $this->server('HTTP_X_FORWARDED_PORT') == 443))
46
-		{
47
-			return 'https';
48
-		}
49
-
50
-		return 'http';
51
-	}
52
-
53
-	/**
54
-	 * Fetch an item from the COOKIE array.
55
-	 *
56
-	 * @param  string  $index  The index key
57
-	 * @param  mixed  $default  The default value
58
-	 *
59
-	 * @return string|array
60
-	 */
61
-	public function cookie($index = null, $default = null)
62
-	{
63
-		return (func_num_args() === 0) ? $_COOKIE : Arr::get($_COOKIE, strtoupper($index), $default);
64
-	}
65
-
66
-	/**
67
-	 * Fetch an item from the FILE array.
68
-	 *
69
-	 * @param  string  $index  The index key
70
-	 * @param  mixed  $default  The default value
71
-	 *
72
-	 * @return string|array
73
-	 */
74
-	public function file($index = null, $default = null)
75
-	{
76
-		return (func_num_args() === 0) ? $_FILES : Arr::get($_FILES, strtoupper($index), $default);
77
-	}
78
-
79
-	/**
80
-	 * Fetch an item from the SERVER array.
81
-	 *
82
-	 * @param  string  $index  The index key
83
-	 * @param  mixed  $default  The default value
84
-	 *
85
-	 * @return string|array
86
-	 */
87
-	public function server($index = null, $default = null)
88
-	{
89
-		return (func_num_args() === 0) ? $_SERVER : Arr::get($_SERVER, strtoupper($index), $default);
90
-	}
34
+    /**
35
+     * Return's the protocol that the request was made with.
36
+     *
37
+     * @return string
38
+     */
39
+    public function protocol()
40
+    {
41
+        if ($this->server('HTTPS') == 'on' ||
42
+            $this->server('HTTPS') == 1 ||
43
+            $this->server('SERVER_PORT') == 443 ||
44
+            (config('security.allow-x-headers', false) && $this->server('HTTP_X_FORWARDED_PROTO') == 'https') ||
45
+            (config('security.allow-x-headers', false) && $this->server('HTTP_X_FORWARDED_PORT') == 443))
46
+        {
47
+            return 'https';
48
+        }
49
+
50
+        return 'http';
51
+    }
52
+
53
+    /**
54
+     * Fetch an item from the COOKIE array.
55
+     *
56
+     * @param  string  $index  The index key
57
+     * @param  mixed  $default  The default value
58
+     *
59
+     * @return string|array
60
+     */
61
+    public function cookie($index = null, $default = null)
62
+    {
63
+        return (func_num_args() === 0) ? $_COOKIE : Arr::get($_COOKIE, strtoupper($index), $default);
64
+    }
65
+
66
+    /**
67
+     * Fetch an item from the FILE array.
68
+     *
69
+     * @param  string  $index  The index key
70
+     * @param  mixed  $default  The default value
71
+     *
72
+     * @return string|array
73
+     */
74
+    public function file($index = null, $default = null)
75
+    {
76
+        return (func_num_args() === 0) ? $_FILES : Arr::get($_FILES, strtoupper($index), $default);
77
+    }
78
+
79
+    /**
80
+     * Fetch an item from the SERVER array.
81
+     *
82
+     * @param  string  $index  The index key
83
+     * @param  mixed  $default  The default value
84
+     *
85
+     * @return string|array
86
+     */
87
+    public function server($index = null, $default = null)
88
+    {
89
+        return (func_num_args() === 0) ? $_SERVER : Arr::get($_SERVER, strtoupper($index), $default);
90
+    }
91 91
 	
92
-	/**
93
-	 * Gets the URI Protocol based setting, will attempt to detect the path 
94
-	 * portion of the current URI.
95
-	 * 
96
-	 * @param  string  $protocol
97
-	 * 
98
-	 * @return string
99
-	 */
100
-	public function detectPath(string $protocol = '') 
101
-	{
102
-		if (empty($protocol)) {
103
-			$protocol = 'REQUEST_URI';
104
-		}
105
-
106
-		switch($protocol) {
107
-			case 'REQUEST_URI':
108
-				$path = $this->parseRequestUri();
109
-				break;
110
-			case 'QUERY_STRING':
111
-				$path = $this->parseQueryString();
112
-				break;
113
-			case 'PATH_INFO':
114
-			default:
115
-				$path = $this->server($protocol) ?? $this->parseRequestUri();
116
-				break;
117
-		}
118
-
119
-		return $path;
120
-	}
121
-
122
-	/**
123
-	 * Filters a value from the start of a string in this case the passed URI string.
124
-	 *
125
-	 * @return string
126
-	 */
127
-	protected function parseRequestUri()
128
-	{
129
-		if ( ! isset($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME'])) {
130
-			return '';
131
-		}
132
-
133
-		$requestURI = $this->server('REQUEST_URI') ?? '/';
134
-		$components = parse_url($requestURI);
135
-		$query      = $components['query'] ?? '';
136
-		$uri        = $components['path'] ?? '';
137
-
138
-		// If the search value is at the start
139
-		if (isset($this->server('SCRIPT_NAME')[0])) {
140
-			if (0 === strpos($uri, $this->server('SCRIPT_NAME'))) {
141
-				$uri = (string) substr($uri, strlen($this->server('SCRIPT_NAME')));
142
-			} elseif (0 < strpos($uri, $this->server('SCRIPT_NAME'))) {
143
-				$uri = (string) substr($uri, strpos($uri, $this->server('SCRIPT_NAME')) + strlen($this->server('SCRIPT_NAME')));
144
-			} elseif (0 === strpos($uri, dirname($this->server('SCRIPT_NAME')))) {
145
-				$uri = (string) substr($uri, strlen(dirname($this->server('SCRIPT_NAME'))));
146
-			}
147
-		}
148
-
149
-		// This section ensures that even on servers that require the URI to contain 
150
-		// the query string (Nginx) is the correctly
151
-		if ('' === trim($uri, '/') && 0 === strncmp($query, '/', 1)) {
152
-			$query					 = explode('?', $query, 2);
153
-			$uri  					 = $query[0];
154
-			$_SERVER['QUERY_STRING'] = $query[1] ?? '';
155
-		} else {
156
-			$_SERVER['QUERY_STRING'] = $query;
157
-		}
158
-
159
-		// Parses the string into variables
160
-		parse_str($_SERVER['QUERY_STRING'], $_GET);
161
-
162
-		if ('/' === $uri || '' === $uri) {
163
-			return '';
164
-		}
165
-
166
-		return $this->filterDecode($uri);
167
-	}
168
-
169
-	/**
170
-	 * Will parse QUERY_STRING and automatically detect the URI from it.
171
-	 * 
172
-	 * @return string
173
-	 */
174
-	protected function parseQueryString()
175
-	{
176
-		$uri = $_SERVER['QUERY_STRING'] ?? @getenv('QUERY_STRING');
177
-
178
-		if (trim($uri, '/') === '') {
179
-			return '';
180
-		} elseif (0 === strncmp($uri, '/', 1)) {
181
-			$uri    				 = explode('?', $uri, 2);
182
-			$_SERVER['QUERY_STRING'] = $uri[1] ?? '';
183
-			$uri    				 = $uri[0] ?? '';
184
-		}
185
-
186
-		parse_str($_SERVER['QUERY_STRING'], $_GET);
187
-
188
-		return $this->filterDecode($uri);
189
-	}
190
-
191
-	/**
192
-	 * Filters the uri string remove any malicious characters and inappropriate slashes.
193
-	 *
194
-	 * @param  string  $uri
195
-	 *
196
-	 * @return string
197
-	 */
198
-	protected function filterDecode($uri)
199
-	{
200
-		// Remove all characters except letters,
201
-		// digits and $-_.+!*'(),{}|\\^~[]`<>#%";/?:@&=.
202
-		$uri = filter_var(rawurldecode($uri), FILTER_SANITIZE_URL);
92
+    /**
93
+     * Gets the URI Protocol based setting, will attempt to detect the path 
94
+     * portion of the current URI.
95
+     * 
96
+     * @param  string  $protocol
97
+     * 
98
+     * @return string
99
+     */
100
+    public function detectPath(string $protocol = '') 
101
+    {
102
+        if (empty($protocol)) {
103
+            $protocol = 'REQUEST_URI';
104
+        }
105
+
106
+        switch($protocol) {
107
+            case 'REQUEST_URI':
108
+                $path = $this->parseRequestUri();
109
+                break;
110
+            case 'QUERY_STRING':
111
+                $path = $this->parseQueryString();
112
+                break;
113
+            case 'PATH_INFO':
114
+            default:
115
+                $path = $this->server($protocol) ?? $this->parseRequestUri();
116
+                break;
117
+        }
118
+
119
+        return $path;
120
+    }
121
+
122
+    /**
123
+     * Filters a value from the start of a string in this case the passed URI string.
124
+     *
125
+     * @return string
126
+     */
127
+    protected function parseRequestUri()
128
+    {
129
+        if ( ! isset($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME'])) {
130
+            return '';
131
+        }
132
+
133
+        $requestURI = $this->server('REQUEST_URI') ?? '/';
134
+        $components = parse_url($requestURI);
135
+        $query      = $components['query'] ?? '';
136
+        $uri        = $components['path'] ?? '';
137
+
138
+        // If the search value is at the start
139
+        if (isset($this->server('SCRIPT_NAME')[0])) {
140
+            if (0 === strpos($uri, $this->server('SCRIPT_NAME'))) {
141
+                $uri = (string) substr($uri, strlen($this->server('SCRIPT_NAME')));
142
+            } elseif (0 < strpos($uri, $this->server('SCRIPT_NAME'))) {
143
+                $uri = (string) substr($uri, strpos($uri, $this->server('SCRIPT_NAME')) + strlen($this->server('SCRIPT_NAME')));
144
+            } elseif (0 === strpos($uri, dirname($this->server('SCRIPT_NAME')))) {
145
+                $uri = (string) substr($uri, strlen(dirname($this->server('SCRIPT_NAME'))));
146
+            }
147
+        }
148
+
149
+        // This section ensures that even on servers that require the URI to contain 
150
+        // the query string (Nginx) is the correctly
151
+        if ('' === trim($uri, '/') && 0 === strncmp($query, '/', 1)) {
152
+            $query					 = explode('?', $query, 2);
153
+            $uri  					 = $query[0];
154
+            $_SERVER['QUERY_STRING'] = $query[1] ?? '';
155
+        } else {
156
+            $_SERVER['QUERY_STRING'] = $query;
157
+        }
158
+
159
+        // Parses the string into variables
160
+        parse_str($_SERVER['QUERY_STRING'], $_GET);
161
+
162
+        if ('/' === $uri || '' === $uri) {
163
+            return '';
164
+        }
165
+
166
+        return $this->filterDecode($uri);
167
+    }
168
+
169
+    /**
170
+     * Will parse QUERY_STRING and automatically detect the URI from it.
171
+     * 
172
+     * @return string
173
+     */
174
+    protected function parseQueryString()
175
+    {
176
+        $uri = $_SERVER['QUERY_STRING'] ?? @getenv('QUERY_STRING');
177
+
178
+        if (trim($uri, '/') === '') {
179
+            return '';
180
+        } elseif (0 === strncmp($uri, '/', 1)) {
181
+            $uri    				 = explode('?', $uri, 2);
182
+            $_SERVER['QUERY_STRING'] = $uri[1] ?? '';
183
+            $uri    				 = $uri[0] ?? '';
184
+        }
185
+
186
+        parse_str($_SERVER['QUERY_STRING'], $_GET);
187
+
188
+        return $this->filterDecode($uri);
189
+    }
190
+
191
+    /**
192
+     * Filters the uri string remove any malicious characters and inappropriate slashes.
193
+     *
194
+     * @param  string  $uri
195
+     *
196
+     * @return string
197
+     */
198
+    protected function filterDecode($uri)
199
+    {
200
+        // Remove all characters except letters,
201
+        // digits and $-_.+!*'(),{}|\\^~[]`<>#%";/?:@&=.
202
+        $uri = filter_var(rawurldecode($uri), FILTER_SANITIZE_URL);
203 203
 		
204
-		// Return argument if not empty or return a single slash
205
-		return trim($uri, '/') ?: '/';
206
-	}
204
+        // Return argument if not empty or return a single slash
205
+        return trim($uri, '/') ?: '/';
206
+    }
207 207
 	
208
-	/**
209
-	 * Parse the base URL.
210
-	 * 
211
-	 * @return string
212
-	 */
213
-	public function parseBaseUrl() 
214
-	{
215
-		$filename = basename($this->server('SCRIPT_FILENAME'));
208
+    /**
209
+     * Parse the base URL.
210
+     * 
211
+     * @return string
212
+     */
213
+    public function parseBaseUrl() 
214
+    {
215
+        $filename = basename($this->server('SCRIPT_FILENAME'));
216 216
 		
217
-		if ($filename === basename($this->server('SCRIPT_NAME'))) {
218
-			$baseUrl = $this->server('SCRIPT_NAME');
219
-		} elseif ($filename === basename($this->server('PHP_SELF'))) {
220
-			$baseUrl = $this->server('PHP_SELF');
221
-		} elseif ($filename === basename($this->server('ORIG_SCRIPT_NAME'))) {
222
-			$baseUrl = $this->server('ORIG_SCRIPT_NAME');
223
-		} else {
224
-			$path    = $this->server('PHP_SELF', '');
225
-			$file    = $this->server('SCRIPT_FILENAME', '');
226
-			$segs    = explode('/', trim($file, '/'));
227
-			$segs    = array_reverse($segs);
228
-			$index   = 0;
229
-			$last    = count($segs);
230
-			$baseUrl = '';
217
+        if ($filename === basename($this->server('SCRIPT_NAME'))) {
218
+            $baseUrl = $this->server('SCRIPT_NAME');
219
+        } elseif ($filename === basename($this->server('PHP_SELF'))) {
220
+            $baseUrl = $this->server('PHP_SELF');
221
+        } elseif ($filename === basename($this->server('ORIG_SCRIPT_NAME'))) {
222
+            $baseUrl = $this->server('ORIG_SCRIPT_NAME');
223
+        } else {
224
+            $path    = $this->server('PHP_SELF', '');
225
+            $file    = $this->server('SCRIPT_FILENAME', '');
226
+            $segs    = explode('/', trim($file, '/'));
227
+            $segs    = array_reverse($segs);
228
+            $index   = 0;
229
+            $last    = count($segs);
230
+            $baseUrl = '';
231 231
 			
232
-			do 	{
233
-				$seg     = $segs[$index];
234
-				$baseUrl = '/'.$seg.$baseUrl;
235
-				++$index;
236
-			} while ($last > $index && (false !== $pos = strpos($path, $baseUrl)) && 0 != $pos);
237
-		}
238
-
239
-		// Does the baseUrl have anything in common with the request_uri?
240
-		$requestUri = $this->parseRequestUri();
241
-
242
-		if ('' !== $requestUri && '/' !== $requestUri[0]) {
243
-			$requestUri = '/'.$requestUri;
244
-		}
245
-
246
-		$baseUrl = dirname($baseUrl);
247
-
248
-		if (empty($baseUrl) || false !== strpos(rawurldecode($requestUri), $baseUrl)) {
249
-			// no match whatsoever; set it blank
250
-			return '';
251
-		}
232
+            do 	{
233
+                $seg     = $segs[$index];
234
+                $baseUrl = '/'.$seg.$baseUrl;
235
+                ++$index;
236
+            } while ($last > $index && (false !== $pos = strpos($path, $baseUrl)) && 0 != $pos);
237
+        }
238
+
239
+        // Does the baseUrl have anything in common with the request_uri?
240
+        $requestUri = $this->parseRequestUri();
241
+
242
+        if ('' !== $requestUri && '/' !== $requestUri[0]) {
243
+            $requestUri = '/'.$requestUri;
244
+        }
245
+
246
+        $baseUrl = dirname($baseUrl);
247
+
248
+        if (empty($baseUrl) || false !== strpos(rawurldecode($requestUri), $baseUrl)) {
249
+            // no match whatsoever; set it blank
250
+            return '';
251
+        }
252 252
 		
253
-		// If using mod_rewrite or ISAPI_Rewrite strip the script filename
254
-		// out of baseUrl. $pos !== 0 makes sure it is not matching a value
255
-		// from PATH_INFO or QUERY_STRING
256
-		if (strlen($requestUri) >= strlen($baseUrl) && (false !== $pos = strpos($requestUri, $baseUrl)) && 0 !== $pos) {
257
-			$baseUrl = substr($requestUri, 0, $pos + strlen($baseUrl));
258
-		}
253
+        // If using mod_rewrite or ISAPI_Rewrite strip the script filename
254
+        // out of baseUrl. $pos !== 0 makes sure it is not matching a value
255
+        // from PATH_INFO or QUERY_STRING
256
+        if (strlen($requestUri) >= strlen($baseUrl) && (false !== $pos = strpos($requestUri, $baseUrl)) && 0 !== $pos) {
257
+            $baseUrl = substr($requestUri, 0, $pos + strlen($baseUrl));
258
+        }
259 259
 		
260
-		return rtrim($baseUrl, '/'.DIRECTORY_SEPARATOR);
261
-	}
262
-
263
-	/**
264
-	 * Parse the path info.
265
-	 * 
266
-	 * @return string
267
-	 */
268
-	public function parsePathInfo()
269
-	{
270
-		if (null === ($requestUri = $this->parseRequestUri())) {
271
-			return '/';
272
-		}
273
-
274
-		// Remove the query string from REQUEST_URI
275
-		if (false !== $pos = strpos($requestUri, '?')) {
276
-			$requestUri = substr($requestUri, 0, $pos);
277
-		}
278
-
279
-		if ('' !== $requestUri && '/' !== $requestUri[0]) {
280
-			$requestUri = '/'.$requestUri;
281
-		}
282
-
283
-		if (null === ($baseUrl = $this->parseBaseUrl())) {
284
-			return $requestUri;
285
-		}
286
-
287
-		$pathInfo = substr($requestUri, strlen($baseUrl));
288
-
289
-		if (false === $pathInfo && '' === $pathInfo) {
290
-			return '/';
291
-		}
260
+        return rtrim($baseUrl, '/'.DIRECTORY_SEPARATOR);
261
+    }
262
+
263
+    /**
264
+     * Parse the path info.
265
+     * 
266
+     * @return string
267
+     */
268
+    public function parsePathInfo()
269
+    {
270
+        if (null === ($requestUri = $this->parseRequestUri())) {
271
+            return '/';
272
+        }
273
+
274
+        // Remove the query string from REQUEST_URI
275
+        if (false !== $pos = strpos($requestUri, '?')) {
276
+            $requestUri = substr($requestUri, 0, $pos);
277
+        }
278
+
279
+        if ('' !== $requestUri && '/' !== $requestUri[0]) {
280
+            $requestUri = '/'.$requestUri;
281
+        }
282
+
283
+        if (null === ($baseUrl = $this->parseBaseUrl())) {
284
+            return $requestUri;
285
+        }
286
+
287
+        $pathInfo = substr($requestUri, strlen($baseUrl));
288
+
289
+        if (false === $pathInfo && '' === $pathInfo) {
290
+            return '/';
291
+        }
292 292
 		
293
-		return (string) $pathInfo;
294
-	}
293
+        return (string) $pathInfo;
294
+    }
295 295
 }
296 296
\ No newline at end of file
Please login to merge, or discard this patch.
src/components/Http/Contributors/Files.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -42,21 +42,21 @@
 block discarded – undo
42 42
     }
43 43
 
44 44
     /**
45
-	 * {@inheritdoc}
46
-	 */
47
-	public function replace(array $files = [])
48
-	{
49
-		$this->parameters = [];
45
+     * {@inheritdoc}
46
+     */
47
+    public function replace(array $files = [])
48
+    {
49
+        $this->parameters = [];
50 50
         $this->add($files);
51
-	}
51
+    }
52 52
 
53
-	/**
54
-	 * {@inheritdoc}
55
-	 */
56
-	public function add(array $files = [])
57
-	{
53
+    /**
54
+     * {@inheritdoc}
55
+     */
56
+    public function add(array $files = [])
57
+    {
58 58
         foreach ($files as $key => $file) {
59 59
             $this->set($key, $file);
60 60
         }
61
-	}
61
+    }
62 62
 }
63 63
\ No newline at end of file
Please login to merge, or discard this patch.
src/components/Debug/GDebug.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 					$this->system->endOutputBuffering();
160 160
 				}
161 161
 
162
-				if (Misc::sendHeaders() && $handlerContentType)	{
162
+				if (Misc::sendHeaders() && $handlerContentType) {
163 163
 					header("Content-Type: {$handlerContentType}");
164 164
 				}
165 165
 			}
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 
315 315
 		if ( ! $handler instanceof MainHandler) {
316 316
 			throw new InvalidArgumentException(
317
-				"Argument to " . __METHOD__ . " must be a callable, or instance of ".
317
+				"Argument to ".__METHOD__." must be a callable, or instance of ".
318 318
 				"Syscodes\\Contracts\\Debug\\Handler"
319 319
 			);
320 320
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -142,8 +142,7 @@
 block discarded – undo
142 142
 			}
143 143
 	
144 144
 			$Quit = $handlerResponse == MainHandler::QUIT && $this->allowQuit();
145
-		}
146
-		finally {
145
+		} finally {
147 146
 			// Returns the contents of the output buffer
148 147
 			$output = $this->system->CleanOutputBuffer();	
149 148
 		}
Please login to merge, or discard this patch.
Indentation   +387 added lines, -387 removed lines patch added patch discarded remove patch
@@ -41,406 +41,406 @@
 block discarded – undo
41 41
  */
42 42
 class GDebug implements DebugContract
43 43
 {
44
-	/**
45
-	 * Allow Handlers to force the script to quit.
46
-	 * 
47
-	 * @var bool $allowQuit
48
-	 */
49
-	protected $allowQuit = true;
44
+    /**
45
+     * Allow Handlers to force the script to quit.
46
+     * 
47
+     * @var bool $allowQuit
48
+     */
49
+    protected $allowQuit = true;
50 50
 	
51
-	/**
52
-	 * Benchmark instance.
53
-	 * 
54
-	 * @var string $benchmark
55
-	 */
56
-	protected $benchmark;
57
-
58
-	/**
59
-	 * The handler stack.
60
-	 * 
61
-	 * @var array $handlerStack
62
-	 */
63
-	protected $handlerStack = [];
64
-
65
-	/**
66
-	 * The send Http code by default: 500 Internal Server Error.
67
-	 * 
68
-	 * @var bool $sendHttpCode
69
-	 */
70
-	protected $sendHttpCode = 500;
71
-
72
-	/**
73
-	 * The send output.
74
-	 * 
75
-	 * @var bool $sendOutput
76
-	 */
77
-	protected $sendOutput = true;
78
-
79
-	/**
80
-	 * The functions of system what control errors and exceptions.
81
-	 * 
82
-	 * @var string $system
83
-	 */
84
-	protected $system;
85
-
86
-	/**
87
-	 * In certain scenarios, like in shutdown handler, we can not throw exceptions.
88
-	 * 
89
-	 * @var bool $throwExceptions
90
-	 */
91
-	protected $throwExceptions = true;
92
-
93
-	/**
94
-	 * Constructor. The Debug class instance.
95
-	 * 
96
-	 * @param  \Syscodes\Debug\Util\System|null  $system
97
-	 * 
98
-	 * @return void
99
-	 */
100
-	public function __construct(System $system = null)
101
-	{
102
-		$this->system    = $system ?: new System;
103
-		$this->benchmark = new Benchmark;
104
-	}
105
-
106
-	/**
107
-	 * Catches any uncaught errors and exceptions, including most Fatal errors. Will log the 
108
-	 * error, display it if display_errors is on, and fire an event that allows custom actions 
109
-	 * to be taken at this point.
110
-	 *
111
-	 * @param  \Throwable  $exception
112
-	 *
113
-	 * @return string
114
-	 */
115
-	public function handleException(Throwable $exception)
116
-	{	
117
-		// The start benchmark
118
-		$this->benchmark->start('total_execution', LENEVOR_START);
119
-
120
-		$supervisor = $this->getSupervisor($exception);
121
-
122
-		// Start buffer
123
-		$this->system->startOutputBuferring();
124
-
125
-		$handlerResponse    = null;
126
-		$handlerContentType = null;
51
+    /**
52
+     * Benchmark instance.
53
+     * 
54
+     * @var string $benchmark
55
+     */
56
+    protected $benchmark;
57
+
58
+    /**
59
+     * The handler stack.
60
+     * 
61
+     * @var array $handlerStack
62
+     */
63
+    protected $handlerStack = [];
64
+
65
+    /**
66
+     * The send Http code by default: 500 Internal Server Error.
67
+     * 
68
+     * @var bool $sendHttpCode
69
+     */
70
+    protected $sendHttpCode = 500;
71
+
72
+    /**
73
+     * The send output.
74
+     * 
75
+     * @var bool $sendOutput
76
+     */
77
+    protected $sendOutput = true;
78
+
79
+    /**
80
+     * The functions of system what control errors and exceptions.
81
+     * 
82
+     * @var string $system
83
+     */
84
+    protected $system;
85
+
86
+    /**
87
+     * In certain scenarios, like in shutdown handler, we can not throw exceptions.
88
+     * 
89
+     * @var bool $throwExceptions
90
+     */
91
+    protected $throwExceptions = true;
92
+
93
+    /**
94
+     * Constructor. The Debug class instance.
95
+     * 
96
+     * @param  \Syscodes\Debug\Util\System|null  $system
97
+     * 
98
+     * @return void
99
+     */
100
+    public function __construct(System $system = null)
101
+    {
102
+        $this->system    = $system ?: new System;
103
+        $this->benchmark = new Benchmark;
104
+    }
105
+
106
+    /**
107
+     * Catches any uncaught errors and exceptions, including most Fatal errors. Will log the 
108
+     * error, display it if display_errors is on, and fire an event that allows custom actions 
109
+     * to be taken at this point.
110
+     *
111
+     * @param  \Throwable  $exception
112
+     *
113
+     * @return string
114
+     */
115
+    public function handleException(Throwable $exception)
116
+    {	
117
+        // The start benchmark
118
+        $this->benchmark->start('total_execution', LENEVOR_START);
119
+
120
+        $supervisor = $this->getSupervisor($exception);
121
+
122
+        // Start buffer
123
+        $this->system->startOutputBuferring();
124
+
125
+        $handlerResponse    = null;
126
+        $handlerContentType = null;
127 127
 		
128
-		try {
129
-			foreach ($this->handlerStack as $handler) {			
130
-				$handler->setDebug($this);
131
-				$handler->setException($exception);
132
-				$handler->setSupervisor($supervisor);
128
+        try {
129
+            foreach ($this->handlerStack as $handler) {			
130
+                $handler->setDebug($this);
131
+                $handler->setException($exception);
132
+                $handler->setSupervisor($supervisor);
133 133
 				
134
-				$handlerResponse = $handler->handle();
134
+                $handlerResponse = $handler->handle();
135 135
 	
136
-				// Collect the content type for possible sending in the headers
137
-				$handlerContentType = method_exists($handler, 'contentType') ? $handler->contentType() : null;
136
+                // Collect the content type for possible sending in the headers
137
+                $handlerContentType = method_exists($handler, 'contentType') ? $handler->contentType() : null;
138 138
 	
139
-				if (in_array($handlerResponse, [MainHandler::LAST_HANDLER, MainHandler::QUIT])) {
140
-					break;
141
-				}
142
-			}
139
+                if (in_array($handlerResponse, [MainHandler::LAST_HANDLER, MainHandler::QUIT])) {
140
+                    break;
141
+                }
142
+            }
143 143
 	
144
-			$Quit = $handlerResponse == MainHandler::QUIT && $this->allowQuit();
145
-		}
146
-		finally {
147
-			// Returns the contents of the output buffer
148
-			$output = $this->system->CleanOutputBuffer();	
149
-		}
150
-
151
-		// Returns the contents of the output buffer for loading time of page
152
-		$totalTime = $this->benchmark->getElapsedTime('total_execution');
153
-		$output    = str_replace('{elapsed_time}', $totalTime, $output);
154
-
155
-		if ($this->writeToOutput()) {
156
-			if ($Quit) {
157
-				while ($this->system->getOutputBufferLevel() > 0) {
158
-					// Cleanes the output buffer
159
-					$this->system->endOutputBuffering();
160
-				}
161
-
162
-				if (Misc::sendHeaders() && $handlerContentType)	{
163
-					header("Content-Type: {$handlerContentType}");
164
-				}
165
-			}
166
-
167
-			$this->writeToOutputBuffer($output);
168
-		}
169
-
170
-		if ($Quit) {
171
-			$this->system->flushOutputBuffer();
172
-			$this->system->stopException(1);
173
-		}
174
-
175
-		return $output;
176
-	}
177
-
178
-	/**
179
-	 * Allow Handlers to force the script to quit.
180
-	 * 
181
-	 * @param  bool|int|null  $exit
182
-	 * 
183
-	 * @return bool
184
-	 */
185
-	public function allowQuit($exit = null)
186
-	{
187
-		if (func_num_args() == 0) {
188
-			return $this->allowQuit;
189
-		}
190
-
191
-		return $this->allowQuit = (bool) $exit;
192
-	}
193
-
194
-	/**
195
-	 * Lenevor Exception push output directly to the client it the data  
196
-	 * if they are true, but if it is false, the output will be returned 
197
-	 * by exception.
198
-	 * 
199
-	 * @param  bool|int|null  $send
200
-	 *
201
-	 * @return bool
202
-	 */
203
-	public function writeToOutput($send = null)
204
-	{
205
-		if (func_num_args() == 0) {
206
-			return $this->sendOutput;
207
-		}
144
+            $Quit = $handlerResponse == MainHandler::QUIT && $this->allowQuit();
145
+        }
146
+        finally {
147
+            // Returns the contents of the output buffer
148
+            $output = $this->system->CleanOutputBuffer();	
149
+        }
150
+
151
+        // Returns the contents of the output buffer for loading time of page
152
+        $totalTime = $this->benchmark->getElapsedTime('total_execution');
153
+        $output    = str_replace('{elapsed_time}', $totalTime, $output);
154
+
155
+        if ($this->writeToOutput()) {
156
+            if ($Quit) {
157
+                while ($this->system->getOutputBufferLevel() > 0) {
158
+                    // Cleanes the output buffer
159
+                    $this->system->endOutputBuffering();
160
+                }
161
+
162
+                if (Misc::sendHeaders() && $handlerContentType)	{
163
+                    header("Content-Type: {$handlerContentType}");
164
+                }
165
+            }
166
+
167
+            $this->writeToOutputBuffer($output);
168
+        }
169
+
170
+        if ($Quit) {
171
+            $this->system->flushOutputBuffer();
172
+            $this->system->stopException(1);
173
+        }
174
+
175
+        return $output;
176
+    }
177
+
178
+    /**
179
+     * Allow Handlers to force the script to quit.
180
+     * 
181
+     * @param  bool|int|null  $exit
182
+     * 
183
+     * @return bool
184
+     */
185
+    public function allowQuit($exit = null)
186
+    {
187
+        if (func_num_args() == 0) {
188
+            return $this->allowQuit;
189
+        }
190
+
191
+        return $this->allowQuit = (bool) $exit;
192
+    }
193
+
194
+    /**
195
+     * Lenevor Exception push output directly to the client it the data  
196
+     * if they are true, but if it is false, the output will be returned 
197
+     * by exception.
198
+     * 
199
+     * @param  bool|int|null  $send
200
+     *
201
+     * @return bool
202
+     */
203
+    public function writeToOutput($send = null)
204
+    {
205
+        if (func_num_args() == 0) {
206
+            return $this->sendOutput;
207
+        }
208 208
 		
209
-		return $this->sendOutput = (bool) $send;
210
-	}
209
+        return $this->sendOutput = (bool) $send;
210
+    }
211 211
 	
212
-	/**
213
-	 * Generate output to the browser.
214
-	 * 
215
-	 * @param  string  $output
216
-	 * 
217
-	 * @return $this
218
-	 */
219
-	protected function writeToOutputBuffer($output)
220
-	{
221
-		if ($this->sendHttpCode() && Misc::sendHeaders()) {
222
-			$this->system->setHttpResponseCode($this->sendHttpCode());
223
-		}
212
+    /**
213
+     * Generate output to the browser.
214
+     * 
215
+     * @param  string  $output
216
+     * 
217
+     * @return $this
218
+     */
219
+    protected function writeToOutputBuffer($output)
220
+    {
221
+        if ($this->sendHttpCode() && Misc::sendHeaders()) {
222
+            $this->system->setHttpResponseCode($this->sendHttpCode());
223
+        }
224 224
 		
225
-		echo $output;
225
+        echo $output;
226 226
 		
227
-		return $this;
228
-	}
229
-
230
-	/**
231
-	 * Error handler
232
-	 *
233
-	 * This will catch the php native error and treat it as a exception which will 
234
-	 * provide a full back trace on all errors.
235
-	 *
236
-	 * @param  int  $level
237
-	 * @param  string  $message
238
-	 * @param  string|null  $file
239
-	 * @param  int|null  $line
240
-	 *
241
-	 * @throws \ErrorException
242
-	 */
243
-	public function handleError(int $level, string $message, string $file = null, int $line = null)
244
-	{
245
-		if ($level & $this->system->getErrorReportingLevel()) {
246
-			$exception = new ErrorException($message, $level, $level, $file, $line);
247
-
248
-			if ($this->throwExceptions) {
249
-				throw $exception;
250
-			} else {
251
-				$this->handleException($exception);
252
-			}
253
-
254
-			return true;
255
-		}
256
-
257
-		return false;
258
-	}
259
-
260
-	/**
261
-	 * Pushes a handler to the end of the stack.
262
-	 * 
263
-	 * @param  \Callable|\Syscodes\Contracts\Debug\Handler  $handler
264
-	 * 
265
-	 * @return \Syscodes\Contracts\Debug\Handler
266
-	 */
267
-	public function pushHandler($handler)
268
-	{
269
-		return $this->prependHandler($handler);
270
-	}
271
-
272
-	/**
273
-	 * Appends a handler to the end of the stack.
274
-	 * 
275
-	 * @param  \Callable|\Syscodes\Contracts\Debug\Handler  $handler
276
-	 * 
277
-	 * @return $this
278
-	 */
279
-	public function appendHandler($handler)
280
-	{
281
-		array_unshift($this->handlerStack, $this->resolveHandler($handler));
282
-
283
-		return $this;
284
-	}
285
-
286
-	/**
287
-	 * Prepends a handler to the start of the stack.
288
-	 * 
289
-	 * @param  \Callable|\Syscodes\Contracts\Debug\Handler  $handler
290
-	 * 
291
-	 * @return $this
292
-	 */
293
-	public function prependHandler($handler)
294
-	{
295
-		array_unshift($this->handlerStack, $this->resolveHandler($handler));
296
-
297
-		return $this;
298
-	}
299
-
300
-	/**
301
-	 * Create a CallbackHandler from callable and throw if handler is invalid.
302
-	 * 
303
-	 * @param  \Callable|\Syscodes\Contracts\Debug\Handler  $handler
304
-	 * 
305
-	 * @return \Syscodes\Contracts\Debug\Handler
306
-	 * 
307
-	 * @throws \InvalidArgumentException If argument is not callable or instance of \Syscodes\Contracts\Debug\Handler
308
-	 */
309
-	protected function resolveHandler($handler)
310
-	{
311
-		if (is_callable($handler)) {
312
-			$handler = new CallbackHandler($handler);
313
-		}
314
-
315
-		if ( ! $handler instanceof MainHandler) {
316
-			throw new InvalidArgumentException(
317
-				"Argument to " . __METHOD__ . " must be a callable, or instance of ".
318
-				"Syscodes\\Contracts\\Debug\\Handler"
319
-			);
320
-		}
321
-
322
-		return $handler;
323
-	}
324
-
325
-	/**
326
-	 * Returns an array with all handlers, in the order they were added to the stack.
327
-	 * 
328
-	 * @return array
329
-	 */
330
-	public function getHandlers()
331
-	{
332
-		return $this->handlerStack;
333
-	}
334
-
335
-	/**
336
-	 * Clears all handlers in the handlerStack, including the default PleasingPage handler.
337
-	 * 
338
-	 * @return $this
339
-	 */
340
-	public function clearHandlers()
341
-	{
342
-		$this->handlerStack = [];
343
-
344
-		return $this;
345
-	}
346
-
347
-	/**
348
-	 * Removes the last handler in the stack and returns it.
349
-	 * 
350
-	 * @return array|null
351
-	 */
352
-	public function popHandler()
353
-	{
354
-		return array_pop($this->handlerStack);
355
-	}
356
-
357
-	/**
358
-	 * Gets supervisor already specified.
359
-	 * 
360
-	 * @param  \Throwable  $exception
361
-	 * 
362
-	 * @return \Syscodes\Debug\Engine\Supervisor
363
-	 */
364
-	protected function getSupervisor(Throwable $exception)
365
-	{
366
-		return new Supervisor($exception);
367
-	}
368
-
369
-	/**
370
-	 * Unregisters all handlers registered by this Debug instance.
371
-	 * 
372
-	 * @return void
373
-	 */
374
-	public function off()
375
-	{
376
-		$this->system->restoreExceptionHandler();
377
-		$this->system->restoreErrorHandler();
378
-	}
227
+        return $this;
228
+    }
229
+
230
+    /**
231
+     * Error handler
232
+     *
233
+     * This will catch the php native error and treat it as a exception which will 
234
+     * provide a full back trace on all errors.
235
+     *
236
+     * @param  int  $level
237
+     * @param  string  $message
238
+     * @param  string|null  $file
239
+     * @param  int|null  $line
240
+     *
241
+     * @throws \ErrorException
242
+     */
243
+    public function handleError(int $level, string $message, string $file = null, int $line = null)
244
+    {
245
+        if ($level & $this->system->getErrorReportingLevel()) {
246
+            $exception = new ErrorException($message, $level, $level, $file, $line);
247
+
248
+            if ($this->throwExceptions) {
249
+                throw $exception;
250
+            } else {
251
+                $this->handleException($exception);
252
+            }
253
+
254
+            return true;
255
+        }
256
+
257
+        return false;
258
+    }
259
+
260
+    /**
261
+     * Pushes a handler to the end of the stack.
262
+     * 
263
+     * @param  \Callable|\Syscodes\Contracts\Debug\Handler  $handler
264
+     * 
265
+     * @return \Syscodes\Contracts\Debug\Handler
266
+     */
267
+    public function pushHandler($handler)
268
+    {
269
+        return $this->prependHandler($handler);
270
+    }
271
+
272
+    /**
273
+     * Appends a handler to the end of the stack.
274
+     * 
275
+     * @param  \Callable|\Syscodes\Contracts\Debug\Handler  $handler
276
+     * 
277
+     * @return $this
278
+     */
279
+    public function appendHandler($handler)
280
+    {
281
+        array_unshift($this->handlerStack, $this->resolveHandler($handler));
282
+
283
+        return $this;
284
+    }
285
+
286
+    /**
287
+     * Prepends a handler to the start of the stack.
288
+     * 
289
+     * @param  \Callable|\Syscodes\Contracts\Debug\Handler  $handler
290
+     * 
291
+     * @return $this
292
+     */
293
+    public function prependHandler($handler)
294
+    {
295
+        array_unshift($this->handlerStack, $this->resolveHandler($handler));
296
+
297
+        return $this;
298
+    }
299
+
300
+    /**
301
+     * Create a CallbackHandler from callable and throw if handler is invalid.
302
+     * 
303
+     * @param  \Callable|\Syscodes\Contracts\Debug\Handler  $handler
304
+     * 
305
+     * @return \Syscodes\Contracts\Debug\Handler
306
+     * 
307
+     * @throws \InvalidArgumentException If argument is not callable or instance of \Syscodes\Contracts\Debug\Handler
308
+     */
309
+    protected function resolveHandler($handler)
310
+    {
311
+        if (is_callable($handler)) {
312
+            $handler = new CallbackHandler($handler);
313
+        }
314
+
315
+        if ( ! $handler instanceof MainHandler) {
316
+            throw new InvalidArgumentException(
317
+                "Argument to " . __METHOD__ . " must be a callable, or instance of ".
318
+                "Syscodes\\Contracts\\Debug\\Handler"
319
+            );
320
+        }
321
+
322
+        return $handler;
323
+    }
324
+
325
+    /**
326
+     * Returns an array with all handlers, in the order they were added to the stack.
327
+     * 
328
+     * @return array
329
+     */
330
+    public function getHandlers()
331
+    {
332
+        return $this->handlerStack;
333
+    }
334
+
335
+    /**
336
+     * Clears all handlers in the handlerStack, including the default PleasingPage handler.
337
+     * 
338
+     * @return $this
339
+     */
340
+    public function clearHandlers()
341
+    {
342
+        $this->handlerStack = [];
343
+
344
+        return $this;
345
+    }
346
+
347
+    /**
348
+     * Removes the last handler in the stack and returns it.
349
+     * 
350
+     * @return array|null
351
+     */
352
+    public function popHandler()
353
+    {
354
+        return array_pop($this->handlerStack);
355
+    }
356
+
357
+    /**
358
+     * Gets supervisor already specified.
359
+     * 
360
+     * @param  \Throwable  $exception
361
+     * 
362
+     * @return \Syscodes\Debug\Engine\Supervisor
363
+     */
364
+    protected function getSupervisor(Throwable $exception)
365
+    {
366
+        return new Supervisor($exception);
367
+    }
368
+
369
+    /**
370
+     * Unregisters all handlers registered by this Debug instance.
371
+     * 
372
+     * @return void
373
+     */
374
+    public function off()
375
+    {
376
+        $this->system->restoreExceptionHandler();
377
+        $this->system->restoreErrorHandler();
378
+    }
379 379
 	
380
-	/**
381
-	 * Registers this instance as an error handler.
382
-	 * 
383
-	 * @return void
384
-	 */
385
-	public function on() 
386
-	{
387
-		// Set the exception handler
388
-		$this->system->setExceptionHandler([$this, self::EXCEPTION_HANDLER]);
389
-		// Set the error handler
390
-		$this->system->setErrorHandler([$this, self::ERROR_HANDLER]);
391
-		// Set the handler for shutdown to catch Parse errors
392
-		$this->system->registerShutdownFunction([$this, self::SHUTDOWN_HANDLER]);
393
-	}
394
-
395
-	/**
396
-	 * Lenevor Exception will by default send HTTP code 500, but you may wish
397
-	 * to use 502, 503, or another 5xx family code.
398
-	 * 
399
-	 * @param  bool|int  $code
400
-	 * 
401
-	 * @return int|false
402
-	 * 
403
-	 * @throws \InvalidArgumentException
404
-	 */
405
-	public function sendHttpCode($code = null)
406
-	{
407
-		if (func_num_args() == 0) {
408
-			return $this->sendHttpCode;
409
-		}
380
+    /**
381
+     * Registers this instance as an error handler.
382
+     * 
383
+     * @return void
384
+     */
385
+    public function on() 
386
+    {
387
+        // Set the exception handler
388
+        $this->system->setExceptionHandler([$this, self::EXCEPTION_HANDLER]);
389
+        // Set the error handler
390
+        $this->system->setErrorHandler([$this, self::ERROR_HANDLER]);
391
+        // Set the handler for shutdown to catch Parse errors
392
+        $this->system->registerShutdownFunction([$this, self::SHUTDOWN_HANDLER]);
393
+    }
394
+
395
+    /**
396
+     * Lenevor Exception will by default send HTTP code 500, but you may wish
397
+     * to use 502, 503, or another 5xx family code.
398
+     * 
399
+     * @param  bool|int  $code
400
+     * 
401
+     * @return int|false
402
+     * 
403
+     * @throws \InvalidArgumentException
404
+     */
405
+    public function sendHttpCode($code = null)
406
+    {
407
+        if (func_num_args() == 0) {
408
+            return $this->sendHttpCode;
409
+        }
410 410
 		
411
-		if ( ! $code) {
412
-			return $this->sendHttpCode = false;
413
-		}
411
+        if ( ! $code) {
412
+            return $this->sendHttpCode = false;
413
+        }
414 414
 		
415
-		if ($code === true) {
416
-			$code = 500;
417
-		}
415
+        if ($code === true) {
416
+            $code = 500;
417
+        }
418 418
 		
419
-		if ($code < 400 || 600 <= $code) {
420
-			throw new InvalidArgumentException("Invalid status code {$code}, must be 4xx or 5xx");
421
-		}
419
+        if ($code < 400 || 600 <= $code) {
420
+            throw new InvalidArgumentException("Invalid status code {$code}, must be 4xx or 5xx");
421
+        }
422 422
 		
423
-		return $this->sendHttpCode = $code;
424
-	}
425
-
426
-	/**
427
-	 * This will catch errors that are generated at the shutdown level of execution.
428
-	 *
429
-	 * @return void
430
-	 *
431
-	 * @throws \ErrorException
432
-	 */
433
-	public function handleShutdown()
434
-	{
435
-		$this->throwExceptions = false;
436
-
437
-		$error = $this->system->getLastError();
438
-
439
-		// If we've got an error that hasn't been displayed, then convert
440
-		// it to an Exception and use the Exception handler to display it
441
-		// to the user
442
-		if ($error && Misc::isFatalError($error['type'])) {
443
-			$this->errorHandler($error['type'], $error['message'], $error['file'], $error['line']);
444
-		}
445
-	}
423
+        return $this->sendHttpCode = $code;
424
+    }
425
+
426
+    /**
427
+     * This will catch errors that are generated at the shutdown level of execution.
428
+     *
429
+     * @return void
430
+     *
431
+     * @throws \ErrorException
432
+     */
433
+    public function handleShutdown()
434
+    {
435
+        $this->throwExceptions = false;
436
+
437
+        $error = $this->system->getLastError();
438
+
439
+        // If we've got an error that hasn't been displayed, then convert
440
+        // it to an Exception and use the Exception handler to display it
441
+        // to the user
442
+        if ($error && Misc::isFatalError($error['type'])) {
443
+            $this->errorHandler($error['type'], $error['message'], $error['file'], $error['line']);
444
+        }
445
+    }
446 446
 }
447 447
\ No newline at end of file
Please login to merge, or discard this patch.
src/components/Debug/ExceptionHandler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
         $caughtLength = $this->caughtLength = 0;
161 161
 
162
-        ob_start(function ($buffer) {
162
+        ob_start(function($buffer) {
163 163
             $this->caughtBuffer = $buffer;
164 164
 
165 165
             return '';            
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         $this->sendPhpResponse($exception);
169 169
 
170 170
         if (isset($this->caughtBuffer[0])) {
171
-            ob_start(function ($buffer) {
171
+            ob_start(function($buffer) {
172 172
                 if ($this->caughtLength) {
173 173
                     $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength);
174 174
 
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
         }
459 459
 
460 460
         if (is_string($frmt)) {
461
-            $index  = strpos($f = $frmt, '&', max(strrpos($f, '%f'), strrpos($f, '%l')) ?: strlen($f));
461
+            $index = strpos($f = $frmt, '&', max(strrpos($f, '%f'), strrpos($f, '%l')) ?: strlen($f));
462 462
             $frmt = [substr($f, 0, $index)] + preg_split('/&([^>]++)>/', substr($f, $index), -1, PREG_SPLIT_DELIM_CAPTURE);
463 463
 
464 464
             for ($index = 1; isset($frmt[$index]); ++$index) {
Please login to merge, or discard this patch.
src/components/Debug/Exceptions/Handlers/PleasingPageHandler.php 3 patches
Indentation   +407 added lines, -407 removed lines patch added patch discarded remove patch
@@ -41,429 +41,429 @@
 block discarded – undo
41 41
  */
42 42
 class PleasingPageHandler extends MainHandler
43 43
 {
44
-	/**
45
-	 * The brand main of handler.
46
-	 * 
47
-	 * @var string $brand
48
-	 */
49
-	protected $brand = 'Lenevor Debug';
50
-
51
-	/**
52
-	 * A string identifier for a known IDE/text editor, or a closure
53
-	 * that resolves a string that can be used to open a given file
54
-	 * in an editor.
55
-	 * 
56
-	 * @var mixed $editor
57
-	 */
58
-	protected $editor;
59
-
60
-	/**
61
-	 * A list of known editor strings.
62
-	 * 
63
-	 * @var array $editors
64
-	 */
65
-	protected $editors = [
66
-		"vscode"   => "vscode://file/%file:%line",
67
-		"sublime"  => "subl://open?url=file://%file&line=%line",
68
-		"phpstorm" => "phpstorm://open?file://%file&line=%line",
69
-		"textmate" => "txmt://open?url=file://%file&line=%line",
70
-		"atom"     => "atom://core/open/file?filename=%file&line=%line",
71
-	];
44
+    /**
45
+     * The brand main of handler.
46
+     * 
47
+     * @var string $brand
48
+     */
49
+    protected $brand = 'Lenevor Debug';
50
+
51
+    /**
52
+     * A string identifier for a known IDE/text editor, or a closure
53
+     * that resolves a string that can be used to open a given file
54
+     * in an editor.
55
+     * 
56
+     * @var mixed $editor
57
+     */
58
+    protected $editor;
59
+
60
+    /**
61
+     * A list of known editor strings.
62
+     * 
63
+     * @var array $editors
64
+     */
65
+    protected $editors = [
66
+        "vscode"   => "vscode://file/%file:%line",
67
+        "sublime"  => "subl://open?url=file://%file&line=%line",
68
+        "phpstorm" => "phpstorm://open?file://%file&line=%line",
69
+        "textmate" => "txmt://open?url=file://%file&line=%line",
70
+        "atom"     => "atom://core/open/file?filename=%file&line=%line",
71
+    ];
72 72
 	
73
-	/**
74
-	 * The page title main of handler.
75
-	 * 
76
-	 * @var string $pageTitle
77
-	 */
78
-	protected $pageTitle = 'Lenevor Debug! There was an error.';
73
+    /**
74
+     * The page title main of handler.
75
+     * 
76
+     * @var string $pageTitle
77
+     */
78
+    protected $pageTitle = 'Lenevor Debug! There was an error.';
79 79
 	
80
-	/**
81
-	 * Fast lookup cache for known resource locations.
82
-	 * 
83
-	 * @var array $resourceCache
84
-	 */
85
-	protected $resourceCache = [];
80
+    /**
81
+     * Fast lookup cache for known resource locations.
82
+     * 
83
+     * @var array $resourceCache
84
+     */
85
+    protected $resourceCache = [];
86 86
 	
87
-	/**
88
-	 * The path to the directory containing the html error template directories.
89
-	 * 
90
-	 * @var array $searchPaths
91
-	 */
92
-	protected $searchPaths = [];
93
-
94
-	/**
95
-	 * Gets the table of data.
96
-	 * 
97
-	 * @var array $tables
98
-	 */
99
-	protected $tables = [];
87
+    /**
88
+     * The path to the directory containing the html error template directories.
89
+     * 
90
+     * @var array $searchPaths
91
+     */
92
+    protected $searchPaths = [];
93
+
94
+    /**
95
+     * Gets the table of data.
96
+     * 
97
+     * @var array $tables
98
+     */
99
+    protected $tables = [];
100 100
 	
101
-	/**
102
-	 * The template handler system.
103
-	 * 
104
-	 * @var string $template
105
-	 */
106
-	protected $template;	
101
+    /**
102
+     * The template handler system.
103
+     * 
104
+     * @var string $template
105
+     */
106
+    protected $template;	
107 107
 	
108
-	/**
109
-	 * Constructor. The PleasingPageHandler class.
110
-	 * 
111
-	 * @return void
112
-	 */
113
-	public function __construct()
114
-	{
115
-		$this->template      = new TemplateHandler;
116
-		$this->searchPaths[] = dirname(__DIR__).DIRECTORY_SEPARATOR.'Resources';
117
-	}
118
-
119
-	/**
120
-	 * Adds an editor resolver, identified by a string name, and that may be a 
121
-	 * string path, or a callable resolver.
122
-	 * 
123
-	 * @param  string            $identifier
124
-	 * @param  string|\Callable  $resolver
125
-	 * 
126
-	 * @return void
127
-	 */
128
-	public function addEditor($identifier, $resolver)
129
-	{
130
-		$this->editors[$identifier] = $resolver;
131
-	}
132
-
133
-	/**
134
-	 * Adds an entry to the list of tables displayed in the template.
135
-	 * The expected data is a simple associative array. Any nested arrays
136
-	 * will be flattened with print_r.
137
-	 * 
138
-	 * @param  \Syscodes\Contracts\Debug\Table  $table
139
-	 * 
140
-	 * @return array
141
-	 */
142
-	public function addTables(Table $table)
143
-	{
144
-		$this->tables[] = $table;
145
-	}
108
+    /**
109
+     * Constructor. The PleasingPageHandler class.
110
+     * 
111
+     * @return void
112
+     */
113
+    public function __construct()
114
+    {
115
+        $this->template      = new TemplateHandler;
116
+        $this->searchPaths[] = dirname(__DIR__).DIRECTORY_SEPARATOR.'Resources';
117
+    }
118
+
119
+    /**
120
+     * Adds an editor resolver, identified by a string name, and that may be a 
121
+     * string path, or a callable resolver.
122
+     * 
123
+     * @param  string            $identifier
124
+     * @param  string|\Callable  $resolver
125
+     * 
126
+     * @return void
127
+     */
128
+    public function addEditor($identifier, $resolver)
129
+    {
130
+        $this->editors[$identifier] = $resolver;
131
+    }
132
+
133
+    /**
134
+     * Adds an entry to the list of tables displayed in the template.
135
+     * The expected data is a simple associative array. Any nested arrays
136
+     * will be flattened with print_r.
137
+     * 
138
+     * @param  \Syscodes\Contracts\Debug\Table  $table
139
+     * 
140
+     * @return array
141
+     */
142
+    public function addTables(Table $table)
143
+    {
144
+        $this->tables[] = $table;
145
+    }
146 146
 	
147
-	/**
148
-	 * Gathers the variables that will be made available to the view.
149
-	 * 
150
-	 * @return  array
151
-	 */
152
-	protected function collectionVars()
153
-	{
154
-		$supervisor = $this->getSupervisor();
155
-		$style      = file_get_contents($this->getResource('css/debug.base.css'));
156
-		$jscript    = file_get_contents($this->getResource('js/debug.base.js'));
157
-		$tables     = array_merge($this->getDefaultTables(), $this->tables);
147
+    /**
148
+     * Gathers the variables that will be made available to the view.
149
+     * 
150
+     * @return  array
151
+     */
152
+    protected function collectionVars()
153
+    {
154
+        $supervisor = $this->getSupervisor();
155
+        $style      = file_get_contents($this->getResource('css/debug.base.css'));
156
+        $jscript    = file_get_contents($this->getResource('js/debug.base.js'));
157
+        $tables     = array_merge($this->getDefaultTables(), $this->tables);
158 158
 		
159
-		return [ 
160
-			'class'             => explode('\\', $supervisor->getExceptionName()),
161
-			'stylesheet'        => preg_replace('#[\r\n\t ]+#', ' ', $style),
162
-			'javascript'        => preg_replace('#[\r\n\t ]+#', ' ', $jscript),
163
-			'header'            => $this->getResource('views/header.php'),
164
-			'sidebar'           => $this->getResource('views/sidebar.php'),
165
-			'frame_description' => $this->getResource('views/frame_description.php'),
166
-			'frame_list'        => $this->getResource('views/frame_list.php'),
167
-			'details_panel'     => $this->getResource('views/details_panel.php'),
168
-			'code_source'       => $this->getResource('views/code_source.php'),
169
-			'details_content'   => $this->getResource('views/details_content.php'),
170
-			'footer'            => $this->getResource('views/footer.php'),
171
-			'plain_exception'   => Formatter::formatExceptionAsPlainText($this->getSupervisor()),
172
-			'handler'           => $this,
173
-			'handlers'          => $this->getDebug()->getHandlers(),
174
-			'debug'             => $this->getDebug(),
175
-			'code'              => $this->getExceptionCode(),
176
-			'message'           => $supervisor->getExceptionMessage(),
177
-			'frames'            => $this->getExceptionFrames(),
178
-			'tables'            => $this->getProcessTables($tables),
179
-		];
180
-	}
159
+        return [ 
160
+            'class'             => explode('\\', $supervisor->getExceptionName()),
161
+            'stylesheet'        => preg_replace('#[\r\n\t ]+#', ' ', $style),
162
+            'javascript'        => preg_replace('#[\r\n\t ]+#', ' ', $jscript),
163
+            'header'            => $this->getResource('views/header.php'),
164
+            'sidebar'           => $this->getResource('views/sidebar.php'),
165
+            'frame_description' => $this->getResource('views/frame_description.php'),
166
+            'frame_list'        => $this->getResource('views/frame_list.php'),
167
+            'details_panel'     => $this->getResource('views/details_panel.php'),
168
+            'code_source'       => $this->getResource('views/code_source.php'),
169
+            'details_content'   => $this->getResource('views/details_content.php'),
170
+            'footer'            => $this->getResource('views/footer.php'),
171
+            'plain_exception'   => Formatter::formatExceptionAsPlainText($this->getSupervisor()),
172
+            'handler'           => $this,
173
+            'handlers'          => $this->getDebug()->getHandlers(),
174
+            'debug'             => $this->getDebug(),
175
+            'code'              => $this->getExceptionCode(),
176
+            'message'           => $supervisor->getExceptionMessage(),
177
+            'frames'            => $this->getExceptionFrames(),
178
+            'tables'            => $this->getProcessTables($tables),
179
+        ];
180
+    }
181 181
 	
182
-	/**
183
-	 * The way in which the data sender (usually the server) can tell the recipient
184
-	 * (the browser, in general) what type of data is being sent in this case, html format tagged.
185
-	 * 
186
-	 * @return string
187
-	 */
188
-	public function contentType()
189
-	{
190
-		return 'text/html;charset=UTF-8';
191
-	}
192
-
193
-	/**
194
-	 * Gets the brand of project.
195
-	 * 
196
-	 * @return string
197
-	 */
198
-	public function getBrand()
199
-	{
200
-		return $this->brand;
201
-	}
202
-
203
-	/**
204
-	 * Returns the default tables.
205
-	 * 
206
-	 * @return \Syscodes\Contracts\Debug\Table[]
207
-	 */
208
-	protected function getDefaultTables()
209
-	{
210
-		return [
211
-			new ArrayTable('GET Data', $_GET),
212
-			new ArrayTable('POST Data', $_POST),
213
-			new ArrayTable('Files', $_FILES),
214
-			new ArrayTable('Cookie', $_COOKIE),
215
-			new ArrayTable('Session', isset($_SESSION) ? $_SESSION : []),
216
-			new ArrayTable('Server/Request Data', $_SERVER),
217
-			new ArrayTable(__('exception.environmentVars'), $_ENV),
218
-		];
219
-	}
220
-
221
-	/**
222
-	 * Get the code of the exception that is currently being handled.
223
-	 * 
224
-	 * @return string
225
-	 */
226
-	protected function getExceptionCode()
227
-	{
228
-		$exception = $this->getException();
229
-		$code      = $exception->getCode();
230
-
231
-		if ($exception instanceof ErrorException) {
232
-			$code = Misc::translateErrorCode($exception->getSeverity());
233
-		}
234
-
235
-		return (string) $code;
236
-	}
237
-
238
-	/**
239
-	 * Get the stack trace frames of the exception that is currently being handled.
240
-	 * 
241
-	 * @return \Syscodes\Debug\Engine\Supervisor;
242
-	 */
243
-	protected function getExceptionFrames()
244
-	{
245
-		$frames = $this->getSupervisor()->getFrames();
182
+    /**
183
+     * The way in which the data sender (usually the server) can tell the recipient
184
+     * (the browser, in general) what type of data is being sent in this case, html format tagged.
185
+     * 
186
+     * @return string
187
+     */
188
+    public function contentType()
189
+    {
190
+        return 'text/html;charset=UTF-8';
191
+    }
192
+
193
+    /**
194
+     * Gets the brand of project.
195
+     * 
196
+     * @return string
197
+     */
198
+    public function getBrand()
199
+    {
200
+        return $this->brand;
201
+    }
202
+
203
+    /**
204
+     * Returns the default tables.
205
+     * 
206
+     * @return \Syscodes\Contracts\Debug\Table[]
207
+     */
208
+    protected function getDefaultTables()
209
+    {
210
+        return [
211
+            new ArrayTable('GET Data', $_GET),
212
+            new ArrayTable('POST Data', $_POST),
213
+            new ArrayTable('Files', $_FILES),
214
+            new ArrayTable('Cookie', $_COOKIE),
215
+            new ArrayTable('Session', isset($_SESSION) ? $_SESSION : []),
216
+            new ArrayTable('Server/Request Data', $_SERVER),
217
+            new ArrayTable(__('exception.environmentVars'), $_ENV),
218
+        ];
219
+    }
220
+
221
+    /**
222
+     * Get the code of the exception that is currently being handled.
223
+     * 
224
+     * @return string
225
+     */
226
+    protected function getExceptionCode()
227
+    {
228
+        $exception = $this->getException();
229
+        $code      = $exception->getCode();
230
+
231
+        if ($exception instanceof ErrorException) {
232
+            $code = Misc::translateErrorCode($exception->getSeverity());
233
+        }
234
+
235
+        return (string) $code;
236
+    }
237
+
238
+    /**
239
+     * Get the stack trace frames of the exception that is currently being handled.
240
+     * 
241
+     * @return \Syscodes\Debug\Engine\Supervisor;
242
+     */
243
+    protected function getExceptionFrames()
244
+    {
245
+        $frames = $this->getSupervisor()->getFrames();
246 246
 		
247
-		return $frames;
248
-	}
247
+        return $frames;
248
+    }
249 249
 	
250
-	/**
251
-	 * Gets the page title web.
252
-	 * 
253
-	 * @return string
254
-	 */
255
-	public function getPageTitle()
256
-	{
257
-		return $this->pageTitle;
258
-	}
259
-
260
-	/**
261
-	 * Processes an array of tables making sure everything is allright.
262
-	 * 
263
-	 * @param  \Syscodes\Contracts\Debug\Table[]  $tables
264
-	 * 
265
-	 * @return array
266
-	 */
267
-	protected function getProcessTables(array $tables)
268
-	{
269
-		$processTables = [];
270
-
271
-		foreach ($tables as $table) {
272
-			if ( ! $table instanceof Table) {
273
-				continue;
274
-			}
275
-
276
-			$label = $table->getLabel();
277
-
278
-			try {
279
-				$data = $table->getData();
280
-
281
-				if ( ! (is_array($data) || $data instanceof Traversable)) {
282
-					$data = [];
283
-				}
284
-			} catch (Exception $e) {
285
-				$data = [];
286
-			}
287
-
288
-			$processTables[$label] = $data;
289
-		}
290
-
291
-		return $processTables;
292
-	}
293
-
294
-	/**
295
-	 * Finds a resource, by its relative path, in all available search paths.
296
-	 *
297
-	 * @param  string  $resource
298
-	 * 
299
-	 * @return string
300
-	 * 
301
-	 * @throws \RuntimeException
302
-	 */
303
-	protected function getResource($resource)
304
-	{
305
-		if (isset($this->resourceCache[$resource])) {
306
-			return $this->resourceCache[$resource];
307
-		}
308
-
309
-		foreach ($this->searchPaths as $path) {
310
-			$fullPath = $path.DIRECTORY_SEPARATOR.$resource;
311
-
312
-			if (is_file($fullPath)) {
313
-				// Cache:
314
-				$this->resourceCache[$resource] = $fullPath;
315
-
316
-				return $fullPath;
317
-			}
318
-		}
319
-
320
-		throw new RuntimeException( 
321
-				"Could not find resource '{$resource}' in any resource paths.". 
322
-				"(searched: ".join(", ", $this->searchPaths).")");
323
-	}
250
+    /**
251
+     * Gets the page title web.
252
+     * 
253
+     * @return string
254
+     */
255
+    public function getPageTitle()
256
+    {
257
+        return $this->pageTitle;
258
+    }
259
+
260
+    /**
261
+     * Processes an array of tables making sure everything is allright.
262
+     * 
263
+     * @param  \Syscodes\Contracts\Debug\Table[]  $tables
264
+     * 
265
+     * @return array
266
+     */
267
+    protected function getProcessTables(array $tables)
268
+    {
269
+        $processTables = [];
270
+
271
+        foreach ($tables as $table) {
272
+            if ( ! $table instanceof Table) {
273
+                continue;
274
+            }
275
+
276
+            $label = $table->getLabel();
277
+
278
+            try {
279
+                $data = $table->getData();
280
+
281
+                if ( ! (is_array($data) || $data instanceof Traversable)) {
282
+                    $data = [];
283
+                }
284
+            } catch (Exception $e) {
285
+                $data = [];
286
+            }
287
+
288
+            $processTables[$label] = $data;
289
+        }
290
+
291
+        return $processTables;
292
+    }
293
+
294
+    /**
295
+     * Finds a resource, by its relative path, in all available search paths.
296
+     *
297
+     * @param  string  $resource
298
+     * 
299
+     * @return string
300
+     * 
301
+     * @throws \RuntimeException
302
+     */
303
+    protected function getResource($resource)
304
+    {
305
+        if (isset($this->resourceCache[$resource])) {
306
+            return $this->resourceCache[$resource];
307
+        }
308
+
309
+        foreach ($this->searchPaths as $path) {
310
+            $fullPath = $path.DIRECTORY_SEPARATOR.$resource;
311
+
312
+            if (is_file($fullPath)) {
313
+                // Cache:
314
+                $this->resourceCache[$resource] = $fullPath;
315
+
316
+                return $fullPath;
317
+            }
318
+        }
319
+
320
+        throw new RuntimeException( 
321
+                "Could not find resource '{$resource}' in any resource paths.". 
322
+                "(searched: ".join(", ", $this->searchPaths).")");
323
+    }
324 324
 	
325
-	/**
326
-	 * Given an exception and status code will display the error to the client.
327
-	 * 
328
-	 * @return int|null
329
-	 */
330
-	public function handle()
331
-	{	
332
-		$templatePath = $this->getResource('debug.layout.php');
333
-
334
-		$vars = $this->collectionVars();
325
+    /**
326
+     * Given an exception and status code will display the error to the client.
327
+     * 
328
+     * @return int|null
329
+     */
330
+    public function handle()
331
+    {	
332
+        $templatePath = $this->getResource('debug.layout.php');
333
+
334
+        $vars = $this->collectionVars();
335 335
 		
336
-		if (empty($vars['message'])) $vars['message'] = __('exception.noMessage');
336
+        if (empty($vars['message'])) $vars['message'] = __('exception.noMessage');
337 337
 		
338
-		$this->template->setVariables($vars);
339
-		$this->template->render($templatePath);
338
+        $this->template->setVariables($vars);
339
+        $this->template->render($templatePath);
340 340
 		
341
-		return MainHandler::QUIT;
342
-	}
343
-
344
-	/**
345
-	 * Set the editor to use to open referenced files, by a string identifier or callable
346
-	 * that will be executed for every file reference. Should return a string.
347
-	 * 
348
-	 * @example  $debug->setEditor(function($file, $line) { return "file:///{$file}"; });
349
-	 * @example  $debug->setEditor('vscode');
350
-	 * 
351
-	 * @param  string  $editor
352
-	 * 
353
-	 * @return void
354
-	 * 
355
-	 * @throws \InvalidArgumentException
356
-	 */
357
-	public function setEditor($editor)
358
-	{
359
-		if ( ! is_callable($editor) && ! isset($this->editors[$editor])) {
360
-			throw new InvalidArgumentException("Unknown editor identifier: [{$editor}]. Known editors: " .
361
-				implode(', ', array_keys($this->editors))
362
-			);
363
-		}
364
-
365
-		$this->editor = $editor;
366
-	}
367
-
368
-	/**
369
-	 * Given a string file path, and an integer file line,
370
-	 * executes the editor resolver and returns.
371
-	 * 
372
-	 * @param  string  $file
373
-	 * @param  int	   $line
374
-	 * 
375
-	 * @return string|bool
376
-	 * 
377
-	 * @throws \UnexpectedValueException
378
-	 */
379
-	public function getEditorAtHref($file, $line)
380
-	{
381
-		$editor = $this->getEditor($file, $line);
382
-
383
-		if (empty($editor))	{
384
-			return false;
385
-		}
386
-
387
-		if ( ! isset($editor['url']) || ! is_string($editor['url'])) {
388
-			throw new UnexpectedValueException(__METHOD__.'should always resolve to a string or a valid editor array');
389
-		}
390
-
391
-		$editor['url'] = str_replace("%file", rawurldecode($file), $editor['url']);
392
-		$editor['url'] = str_replace("%line", rawurldecode($line), $editor['url']);
393
-
394
-		return $editor['url'];
395
-	}
396
-
397
-	/**
398
-	 * The editor must be a valid callable function/closure.
399
-	 * 
400
-	 * @param  string  $file
401
-	 * @param  int	   $line
402
-	 * 
403
-	 * @return array
404
-	 */
405
-	protected function getEditor($file, $line)
406
-	{
407
-		if ( ! $this->editor || ( ! is_string($this->editor) && ! is_callable($this->editor))) {
408
-			return [];
409
-		}
410
-
411
-		if (is_string($this->editor) && isset($this->editors[$this->editor]) && ! is_callable($this->editors[$this->editor])) {
412
-			return ['url' => $this->editors[$this->editor]];
413
-		}
414
-
415
-		if (is_callable($this->editor) || (isset($this->editors[$this->editor]) && is_callable($this->editors[$this->editor]))) {
416
-			if (is_callable($this->editor)) {
417
-				$callback = call_user_func($this->editor, $filePath, $line);
418
-			} else {
419
-				$callback = call_user_func($this->editors[$this->editor], $filePath, $line);
420
-			}
421
-
422
-			if (empty($callback)) {
423
-				return [];
424
-			}
425
-
426
-			if (is_string($callback)) {
427
-				return ['url' => $callback];
428
-			}
341
+        return MainHandler::QUIT;
342
+    }
343
+
344
+    /**
345
+     * Set the editor to use to open referenced files, by a string identifier or callable
346
+     * that will be executed for every file reference. Should return a string.
347
+     * 
348
+     * @example  $debug->setEditor(function($file, $line) { return "file:///{$file}"; });
349
+     * @example  $debug->setEditor('vscode');
350
+     * 
351
+     * @param  string  $editor
352
+     * 
353
+     * @return void
354
+     * 
355
+     * @throws \InvalidArgumentException
356
+     */
357
+    public function setEditor($editor)
358
+    {
359
+        if ( ! is_callable($editor) && ! isset($this->editors[$editor])) {
360
+            throw new InvalidArgumentException("Unknown editor identifier: [{$editor}]. Known editors: " .
361
+                implode(', ', array_keys($this->editors))
362
+            );
363
+        }
364
+
365
+        $this->editor = $editor;
366
+    }
367
+
368
+    /**
369
+     * Given a string file path, and an integer file line,
370
+     * executes the editor resolver and returns.
371
+     * 
372
+     * @param  string  $file
373
+     * @param  int	   $line
374
+     * 
375
+     * @return string|bool
376
+     * 
377
+     * @throws \UnexpectedValueException
378
+     */
379
+    public function getEditorAtHref($file, $line)
380
+    {
381
+        $editor = $this->getEditor($file, $line);
382
+
383
+        if (empty($editor))	{
384
+            return false;
385
+        }
386
+
387
+        if ( ! isset($editor['url']) || ! is_string($editor['url'])) {
388
+            throw new UnexpectedValueException(__METHOD__.'should always resolve to a string or a valid editor array');
389
+        }
390
+
391
+        $editor['url'] = str_replace("%file", rawurldecode($file), $editor['url']);
392
+        $editor['url'] = str_replace("%line", rawurldecode($line), $editor['url']);
393
+
394
+        return $editor['url'];
395
+    }
396
+
397
+    /**
398
+     * The editor must be a valid callable function/closure.
399
+     * 
400
+     * @param  string  $file
401
+     * @param  int	   $line
402
+     * 
403
+     * @return array
404
+     */
405
+    protected function getEditor($file, $line)
406
+    {
407
+        if ( ! $this->editor || ( ! is_string($this->editor) && ! is_callable($this->editor))) {
408
+            return [];
409
+        }
410
+
411
+        if (is_string($this->editor) && isset($this->editors[$this->editor]) && ! is_callable($this->editors[$this->editor])) {
412
+            return ['url' => $this->editors[$this->editor]];
413
+        }
414
+
415
+        if (is_callable($this->editor) || (isset($this->editors[$this->editor]) && is_callable($this->editors[$this->editor]))) {
416
+            if (is_callable($this->editor)) {
417
+                $callback = call_user_func($this->editor, $filePath, $line);
418
+            } else {
419
+                $callback = call_user_func($this->editors[$this->editor], $filePath, $line);
420
+            }
421
+
422
+            if (empty($callback)) {
423
+                return [];
424
+            }
425
+
426
+            if (is_string($callback)) {
427
+                return ['url' => $callback];
428
+            }
429 429
 			
430
-			return ['url' => isset($callback['url']) ? $callback['url'] : $callback];
431
-		}
430
+            return ['url' => isset($callback['url']) ? $callback['url'] : $callback];
431
+        }
432 432
 		
433
-		return [];
434
-	}
435
-
436
-	/**
437
-	 * Registered the editor.
438
-	 * 
439
-	 * @return string
440
-	 */
441
-	public function getEditorcode()
442
-	{
443
-		return $this->editor;
444
-	}
433
+        return [];
434
+    }
435
+
436
+    /**
437
+     * Registered the editor.
438
+     * 
439
+     * @return string
440
+     */
441
+    public function getEditorcode()
442
+    {
443
+        return $this->editor;
444
+    }
445 445
 	
446
-	/**
447
-	 * Sets the brand of project.
448
-	 * 
449
-	 * @param  string  $brand
450
-	 * 
451
-	 * @return void
452
-	 */
453
-	public function setBrand($brand)
454
-	{
455
-		$this->brand = (string) $brand;
456
-	}
446
+    /**
447
+     * Sets the brand of project.
448
+     * 
449
+     * @param  string  $brand
450
+     * 
451
+     * @return void
452
+     */
453
+    public function setBrand($brand)
454
+    {
455
+        $this->brand = (string) $brand;
456
+    }
457 457
 	
458
-	/**
459
-	 * Sets the page title web.
460
-	 * 
461
-	 * @param  string  $title
462
-	 * 
463
-	 * @return void
464
-	 */
465
-	public function setPageTitle($title)
466
-	{
467
-		$this->pageTitle = (string) $title;
468
-	}
458
+    /**
459
+     * Sets the page title web.
460
+     * 
461
+     * @param  string  $title
462
+     * 
463
+     * @return void
464
+     */
465
+    public function setPageTitle($title)
466
+    {
467
+        $this->pageTitle = (string) $title;
468
+    }
469 469
 }
470 470
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 	public function setEditor($editor)
358 358
 	{
359 359
 		if ( ! is_callable($editor) && ! isset($this->editors[$editor])) {
360
-			throw new InvalidArgumentException("Unknown editor identifier: [{$editor}]. Known editors: " .
360
+			throw new InvalidArgumentException("Unknown editor identifier: [{$editor}]. Known editors: ".
361 361
 				implode(', ', array_keys($this->editors))
362 362
 			);
363 363
 		}
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	{
381 381
 		$editor = $this->getEditor($file, $line);
382 382
 
383
-		if (empty($editor))	{
383
+		if (empty($editor)) {
384 384
 			return false;
385 385
 		}
386 386
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -333,7 +333,9 @@
 block discarded – undo
333 333
 
334 334
 		$vars = $this->collectionVars();
335 335
 		
336
-		if (empty($vars['message'])) $vars['message'] = __('exception.noMessage');
336
+		if (empty($vars['message'])) {
337
+		    $vars['message'] = __('exception.noMessage');
338
+		}
337 339
 		
338 340
 		$this->template->setVariables($vars);
339 341
 		$this->template->render($templatePath);
Please login to merge, or discard this patch.