Passed
Push — 0.7.0 ( 371c99...b9ea06 )
by Alexander
03:07 queued 10s
created
src/components/Debug/Exceptions/FrameHandler/Supervisor.php 1 patch
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -31,152 +31,152 @@
 block discarded – undo
31 31
  */
32 32
 class Supervisor
33 33
 {
34
-	/**
35
-	 * Get exception. 
36
-	 * 
37
-	 * @var \Throwable $exception
38
-	 */
39
-	protected $exception;
40
-
41
-	/**
42
-	 * The frame execute errors.
43
-	 * 
44
-	 * @var string $frames
45
-	 */
46
-	protected $frames;
47
-
48
-	/**
49
-	 * Constructor. The Supervisor class instance.
50
-	 * 
51
-	 * @param  \Throwable  $exception
52
-	 * 
53
-	 * @return string
54
-	 */
55
-	public function __construct($exception)
56
-	{
57
-		$this->exception = $exception;
58
-	}
34
+    /**
35
+     * Get exception. 
36
+     * 
37
+     * @var \Throwable $exception
38
+     */
39
+    protected $exception;
40
+
41
+    /**
42
+     * The frame execute errors.
43
+     * 
44
+     * @var string $frames
45
+     */
46
+    protected $frames;
47
+
48
+    /**
49
+     * Constructor. The Supervisor class instance.
50
+     * 
51
+     * @param  \Throwable  $exception
52
+     * 
53
+     * @return string
54
+     */
55
+    public function __construct($exception)
56
+    {
57
+        $this->exception = $exception;
58
+    }
59 59
 	
60
-	/**
61
-	 * Returns an iterator for the inspected exception's frames.
62
-	 * 
63
-	 * @param  \Throwable  $exception
64
-	 * 
65
-	 * @return array 
66
-	 */
67
-	public function getFrames()
68
-	{
69
-		if ($this->frames === null) {
70
-			$frames = $this->getTrace($this->exception);	
71
-
72
-			// Fill empty line/file info for call_user_func_array usages 
73
-			foreach ($frames as $k => $frame) {
74
-				if (empty($frame['file'])) {
75
-					// Default values when file and line are missing
76
-					$file = '[PHP internal Code]';
77
-					$line = 0;
78
-					$next_frame = ! empty($frames[$k + 1]) ? $frames[$k + 1] : [];
79
-					$frames[$k]['file'] = $file;
80
-					$frames[$k]['line'] = $line;
81
-				}
82
-			}
60
+    /**
61
+     * Returns an iterator for the inspected exception's frames.
62
+     * 
63
+     * @param  \Throwable  $exception
64
+     * 
65
+     * @return array 
66
+     */
67
+    public function getFrames()
68
+    {
69
+        if ($this->frames === null) {
70
+            $frames = $this->getTrace($this->exception);	
71
+
72
+            // Fill empty line/file info for call_user_func_array usages 
73
+            foreach ($frames as $k => $frame) {
74
+                if (empty($frame['file'])) {
75
+                    // Default values when file and line are missing
76
+                    $file = '[PHP internal Code]';
77
+                    $line = 0;
78
+                    $next_frame = ! empty($frames[$k + 1]) ? $frames[$k + 1] : [];
79
+                    $frames[$k]['file'] = $file;
80
+                    $frames[$k]['line'] = $line;
81
+                }
82
+            }
83 83
 			
84
-			// Find latest non-error handling frame index ($i) used to remove error handling frames
85
-			$i = 0;
86
-
87
-			foreach ($frames as $k => $frame) {
88
-				if ($frame['file'] == $this->exception->getFile() && $frame['line'] == $this->exception->getLine()) {
89
-					$i = $k;
90
-				}
91
-			}
92
-			// Remove error handling frames
93
-			if ($i > 0) {
94
-				array_splice($frames, 0, $i);
95
-			}
84
+            // Find latest non-error handling frame index ($i) used to remove error handling frames
85
+            $i = 0;
86
+
87
+            foreach ($frames as $k => $frame) {
88
+                if ($frame['file'] == $this->exception->getFile() && $frame['line'] == $this->exception->getLine()) {
89
+                    $i = $k;
90
+                }
91
+            }
92
+            // Remove error handling frames
93
+            if ($i > 0) {
94
+                array_splice($frames, 0, $i);
95
+            }
96 96
 	
97
-			$firstFrame = $this->getFrameFromException($this->exception);	
98
-			array_unshift($frames, $firstFrame);
99
-
100
-			$this->frames = new Collection($frames);
101
-		}
102
-
103
-		return $this->frames;
104
-	}
105
-
106
-	/**
107
-	 * Given an exception, generates an array in the format generated by Exception::getTrace().
108
-	 * 
109
-	 * @param  \Throwable  $exception
110
-	 * 
111
-	 * @return array
112
-	 */
113
-	protected function getFrameFromException(Throwable $exception)
114
-	{
115
-		return [
116
-			'file'  => $exception->getFile(),
117
-			'line'  => $exception->getLine(),
118
-			'class' => get_class($exception),
119
-			'code'  => $exception->getCode(),
120
-			'args'  => [
121
-				$exception->getMessage(),
122
-			],
123
-		];
124
-	}
125
-
126
-	/**
127
-	 * Gets exception already specified.
128
-	 * 
129
-	 * @return \Throwable
130
-	 */
131
-	public function getException()
132
-	{
133
-		return $this->exception;
134
-	}
135
-
136
-	/**
137
-	 * Gets the message of exception.
138
-	 * 
139
-	 * @return string
140
-	 */
141
-	public function getExceptionMessage()
142
-	{
143
-		return $this->exception->getMessage();
144
-	}
145
-
146
-	/**
147
-	 * Gets the class name of exception.
148
-	 * 
149
-	 * @return string
150
-	 */
151
-	public function getExceptionName()
152
-	{
153
-		return getClass($this->exception);
154
-	}
97
+            $firstFrame = $this->getFrameFromException($this->exception);	
98
+            array_unshift($frames, $firstFrame);
99
+
100
+            $this->frames = new Collection($frames);
101
+        }
102
+
103
+        return $this->frames;
104
+    }
105
+
106
+    /**
107
+     * Given an exception, generates an array in the format generated by Exception::getTrace().
108
+     * 
109
+     * @param  \Throwable  $exception
110
+     * 
111
+     * @return array
112
+     */
113
+    protected function getFrameFromException(Throwable $exception)
114
+    {
115
+        return [
116
+            'file'  => $exception->getFile(),
117
+            'line'  => $exception->getLine(),
118
+            'class' => get_class($exception),
119
+            'code'  => $exception->getCode(),
120
+            'args'  => [
121
+                $exception->getMessage(),
122
+            ],
123
+        ];
124
+    }
125
+
126
+    /**
127
+     * Gets exception already specified.
128
+     * 
129
+     * @return \Throwable
130
+     */
131
+    public function getException()
132
+    {
133
+        return $this->exception;
134
+    }
135
+
136
+    /**
137
+     * Gets the message of exception.
138
+     * 
139
+     * @return string
140
+     */
141
+    public function getExceptionMessage()
142
+    {
143
+        return $this->exception->getMessage();
144
+    }
145
+
146
+    /**
147
+     * Gets the class name of exception.
148
+     * 
149
+     * @return string
150
+     */
151
+    public function getExceptionName()
152
+    {
153
+        return getClass($this->exception);
154
+    }
155 155
 	
156
-	/**
157
-	 * Gets the backtrace from an exception.
158
-	 * 
159
-	 * @param  \Throwable  $exception
160
-	 * 
161
-	 * @return array
162
-	 */
163
-	protected function getTrace($exception)
164
-	{
165
-		$traces = $exception->getTrace();
166
-
167
-		if ( ! $exception instanceof ErrorException) {
168
-			return $traces;
169
-		}
170
-
171
-		if ( ! extension_loaded('xdebug') || ! xdebug_is_enabled()) {
172
-			return [];
173
-		}
156
+    /**
157
+     * Gets the backtrace from an exception.
158
+     * 
159
+     * @param  \Throwable  $exception
160
+     * 
161
+     * @return array
162
+     */
163
+    protected function getTrace($exception)
164
+    {
165
+        $traces = $exception->getTrace();
166
+
167
+        if ( ! $exception instanceof ErrorException) {
168
+            return $traces;
169
+        }
170
+
171
+        if ( ! extension_loaded('xdebug') || ! xdebug_is_enabled()) {
172
+            return [];
173
+        }
174 174
 		
175
-		// Use xdebug to get the full stack trace and remove the shutdown handler stack trace
176
-		$stack = array_reverse(xdebug_get_function_stack());
177
-		$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
178
-		$traces = array_diff_key($stack, $trace);
175
+        // Use xdebug to get the full stack trace and remove the shutdown handler stack trace
176
+        $stack = array_reverse(xdebug_get_function_stack());
177
+        $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
178
+        $traces = array_diff_key($stack, $trace);
179 179
 		
180
-		return $traces;
181
-	}
180
+        return $traces;
181
+    }
182 182
 }
183 183
\ No newline at end of file
Please login to merge, or discard this patch.
src/components/Debug/Exceptions/Util/TemplateHandler.php 2 patches
Indentation   +240 added lines, -240 removed lines patch added patch discarded remove patch
@@ -32,283 +32,283 @@
 block discarded – undo
32 32
  */
33 33
 class TemplateHandler
34 34
 {
35
-	/**
36
-	 * Benchmark instance.
37
-	 * 
38
-	 * @var string $benchmark
39
-	 */
40
-	protected $benchmark;
35
+    /**
36
+     * Benchmark instance.
37
+     * 
38
+     * @var string $benchmark
39
+     */
40
+    protected $benchmark;
41 41
 
42
-	/**
43
-	 * Nesting level of the output buffering mechanism.
44
-	 *
45
-	 * @var string $obLevel
46
-	 */
47
-	public $obLevel;
42
+    /**
43
+     * Nesting level of the output buffering mechanism.
44
+     *
45
+     * @var string $obLevel
46
+     */
47
+    public $obLevel;
48 48
 	
49
-	/**
50
-	 * The functions of system what control errors and exceptions.
51
-	 * 
52
-	 * @var string $system
53
-	 */
54
-	protected $system;
49
+    /**
50
+     * The functions of system what control errors and exceptions.
51
+     * 
52
+     * @var string $system
53
+     */
54
+    protected $system;
55 55
 	
56
-	/**
57
-	 * An array of variables to be passed to all templates.
58
-	 * 
59
-	 * @var array $variables
60
-	 */
61
-	protected $variables = [];
56
+    /**
57
+     * An array of variables to be passed to all templates.
58
+     * 
59
+     * @var array $variables
60
+     */
61
+    protected $variables = [];
62 62
 
63
-	/**
64
-	 * Constructor. The TemplateHandler class instance.
65
-	 * 
66
-	 * @return void
67
-	 */
68
-	public function __construct()
69
-	{
70
-		$this->system    = new System;
71
-		$this->benchmark = new Benchmark;
72
-		$this->obLevel   = $this->system->getOutputBufferLevel();
73
-	}
63
+    /**
64
+     * Constructor. The TemplateHandler class instance.
65
+     * 
66
+     * @return void
67
+     */
68
+    public function __construct()
69
+    {
70
+        $this->system    = new System;
71
+        $this->benchmark = new Benchmark;
72
+        $this->obLevel   = $this->system->getOutputBufferLevel();
73
+    }
74 74
 
75
-	/**
76
-	 * Clean Path: This makes nicer looking paths for the error output.
77
-	 *
78
-	 * @param  string  $file
79
-	 *
80
-	 * @return string
81
-	 */
82
-	public function cleanPath($file)
83
-	{
84
-		if (strpos($file, APP_PATH) === 0) {
85
-			$file = 'APP_PATH'.DIRECTORY_SEPARATOR.substr($file, strlen(APP_PATH));
86
-		} elseif (strpos($file, SYS_PATH) === 0) {
87
-			$file = 'SYS_PATH'.DIRECTORY_SEPARATOR.substr($file, strlen(SYS_PATH));
88
-		} elseif (strpos($file, CON_PATH) === 0) {
89
-			$file = 'CON_PATH'.DIRECTORY_SEPARATOR.substr($file, strlen(CON_PATH));
90
-		} elseif (strpos($file, RES_PATH) === 0) {
91
-			$file = 'RES_PATH'.DIRECTORY_SEPARATOR.substr($file, strlen(RES_PATH));
92
-		}
75
+    /**
76
+     * Clean Path: This makes nicer looking paths for the error output.
77
+     *
78
+     * @param  string  $file
79
+     *
80
+     * @return string
81
+     */
82
+    public function cleanPath($file)
83
+    {
84
+        if (strpos($file, APP_PATH) === 0) {
85
+            $file = 'APP_PATH'.DIRECTORY_SEPARATOR.substr($file, strlen(APP_PATH));
86
+        } elseif (strpos($file, SYS_PATH) === 0) {
87
+            $file = 'SYS_PATH'.DIRECTORY_SEPARATOR.substr($file, strlen(SYS_PATH));
88
+        } elseif (strpos($file, CON_PATH) === 0) {
89
+            $file = 'CON_PATH'.DIRECTORY_SEPARATOR.substr($file, strlen(CON_PATH));
90
+        } elseif (strpos($file, RES_PATH) === 0) {
91
+            $file = 'RES_PATH'.DIRECTORY_SEPARATOR.substr($file, strlen(RES_PATH));
92
+        }
93 93
 
94
-		return $file;
95
-	}
94
+        return $file;
95
+    }
96 96
 
97
-	/**
98
-	 * Display memory usage in real-world units. Intended for use
99
-	 * with memory_get_usage, etc.
100
-	 *
101
-	 * @param  int  $bytes
102
-	 *
103
-	 * @return string
104
-	 */
105
-	public function displayMemory(int $bytes)
106
-	{
107
-		if ($bytes < 1024) {
108
-			return $bytes.'B';
109
-		} else if ($bytes < 1048576) {
110
-			return round($bytes/1024, 2).'KB';
111
-		}
97
+    /**
98
+     * Display memory usage in real-world units. Intended for use
99
+     * with memory_get_usage, etc.
100
+     *
101
+     * @param  int  $bytes
102
+     *
103
+     * @return string
104
+     */
105
+    public function displayMemory(int $bytes)
106
+    {
107
+        if ($bytes < 1024) {
108
+            return $bytes.'B';
109
+        } else if ($bytes < 1048576) {
110
+            return round($bytes/1024, 2).'KB';
111
+        }
112 112
 
113
-		return round($bytes/1048576, 2).'MB';
114
-	}
113
+        return round($bytes/1048576, 2).'MB';
114
+    }
115 115
 	
116
-	/**
117
-	 * Format the given value into a human readable string.
118
-	 * 
119
-	 * @param  mixed  $value
120
-	 * 
121
-	 * @return string
122
-	 */
123
-	public function dump($value)
124
-	{
125
-		return htmlspecialchars(print_r($value, true));
126
-	}
116
+    /**
117
+     * Format the given value into a human readable string.
118
+     * 
119
+     * @param  mixed  $value
120
+     * 
121
+     * @return string
122
+     */
123
+    public function dump($value)
124
+    {
125
+        return htmlspecialchars(print_r($value, true));
126
+    }
127 127
 	
128
-	/**
129
-	 * Format the args of the given Frame as a human readable html string.
130
-	 * 
131
-	 * @param  \Syscodes\Debug\FrameHandler\Frame  $frame
132
-	 * 
133
-	 * @return string  The rendered html
134
-	 */
135
-	public function dumpArgs(Frame $frame)
136
-	{
137
-		$html      = '';
138
-		$numFrames = count($frame->getArgs());
128
+    /**
129
+     * Format the args of the given Frame as a human readable html string.
130
+     * 
131
+     * @param  \Syscodes\Debug\FrameHandler\Frame  $frame
132
+     * 
133
+     * @return string  The rendered html
134
+     */
135
+    public function dumpArgs(Frame $frame)
136
+    {
137
+        $html      = '';
138
+        $numFrames = count($frame->getArgs());
139 139
 		
140
-		if ($numFrames > 0) {
141
-			$html = '<ol class="linenums">';
140
+        if ($numFrames > 0) {
141
+            $html = '<ol class="linenums">';
142 142
 			
143
-			foreach ($frame->getArgs() as $j => $frameArg) {
144
-				$html .= '<li>'.$this->dump($frameArg).'</li>';
145
-			}
143
+            foreach ($frame->getArgs() as $j => $frameArg) {
144
+                $html .= '<li>'.$this->dump($frameArg).'</li>';
145
+            }
146 146
 			
147
-			$html .= '</ol>';
148
-		}
147
+            $html .= '</ol>';
148
+        }
149 149
 		
150
-		return $html;
151
-	}
150
+        return $html;
151
+    }
152 152
 
153
-	/**
154
-	 * Escapes a string for output in an HTML document.
155
-	 * 
156
-	 * @param  string  $text
157
-	 * 
158
-	 * @return string
159
-	 */
160
-	public function escape($text)
161
-	{
162
-		$flags = ENT_QUOTES;
153
+    /**
154
+     * Escapes a string for output in an HTML document.
155
+     * 
156
+     * @param  string  $text
157
+     * 
158
+     * @return string
159
+     */
160
+    public function escape($text)
161
+    {
162
+        $flags = ENT_QUOTES;
163 163
 		
164
-		// HHVM has all constants defined, but only ENT_IGNORE
165
-		// works at the moment
166
-		if (defined("ENT_SUBSTITUTE") && ! defined("HHVM_VERSION")) {
167
-			$flags |= ENT_SUBSTITUTE;
168
-		} else {
169
-			$flags |= ENT_IGNORE;
170
-		}
164
+        // HHVM has all constants defined, but only ENT_IGNORE
165
+        // works at the moment
166
+        if (defined("ENT_SUBSTITUTE") && ! defined("HHVM_VERSION")) {
167
+            $flags |= ENT_SUBSTITUTE;
168
+        } else {
169
+            $flags |= ENT_IGNORE;
170
+        }
171 171
 		
172
-		$text = str_replace(chr(9), '    ', $text);
172
+        $text = str_replace(chr(9), '    ', $text);
173 173
 		
174
-		return htmlspecialchars($text, $flags, "UTF-8");
175
-	}
174
+        return htmlspecialchars($text, $flags, "UTF-8");
175
+    }
176 176
 
177
-	/**
178
-	 * Returns all variables for this helper.
179
-	 * 
180
-	 * @return array
181
-	 */
182
-	public function getVariables()
183
-	{
184
-		return $this->variables;
185
-	}
177
+    /**
178
+     * Returns all variables for this helper.
179
+     * 
180
+     * @return array
181
+     */
182
+    public function getVariables()
183
+    {
184
+        return $this->variables;
185
+    }
186 186
 
187
-	/**
188
-	 * Creates a syntax-highlighted version of a PHP file.
189
-	 *
190
-	 * @param  string  $file
191
-	 * @param  int     $lineNumber
192
-	 * @param  int     $lines
193
-	 *
194
-	 * @return bool|string
195
-	 * 
196
-	 * @throws \Exception
197
-	 */
198
-	public function highlightFile($file, $lineNumber, $lines = 15)
199
-	{
200
-		if (empty ($file) || ! is_readable($file)) {
201
-			return false;
202
-		}
187
+    /**
188
+     * Creates a syntax-highlighted version of a PHP file.
189
+     *
190
+     * @param  string  $file
191
+     * @param  int     $lineNumber
192
+     * @param  int     $lines
193
+     *
194
+     * @return bool|string
195
+     * 
196
+     * @throws \Exception
197
+     */
198
+    public function highlightFile($file, $lineNumber, $lines = 15)
199
+    {
200
+        if (empty ($file) || ! is_readable($file)) {
201
+            return false;
202
+        }
203 203
 
204
-		// Set our highlight colors:
205
-		if (function_exists('ini_set')) {
206
-			ini_set('highlight.comment', '#C5C5C5');
207
-			ini_set('highlight.default', '#5399BA');
208
-			ini_set('highlight.html', '#06B');
209
-			ini_set('highlight.keyword', '#7081A5;');
210
-			ini_set('highlight.string', '#d8A134');
211
-		}
204
+        // Set our highlight colors:
205
+        if (function_exists('ini_set')) {
206
+            ini_set('highlight.comment', '#C5C5C5');
207
+            ini_set('highlight.default', '#5399BA');
208
+            ini_set('highlight.html', '#06B');
209
+            ini_set('highlight.keyword', '#7081A5;');
210
+            ini_set('highlight.string', '#d8A134');
211
+        }
212 212
 
213
-		try {
214
-			$origin = file_get_contents($file);
215
-		} catch (Exception $e) {
216
-			return false;
217
-		}
213
+        try {
214
+            $origin = file_get_contents($file);
215
+        } catch (Exception $e) {
216
+            return false;
217
+        }
218 218
 
219
-		$origin  = str_replace(["\r\n", "\r"], "\n", $origin);
220
-		$origin  = explode("\n", highlight_string($origin , true));
221
-		$origin  = str_replace('<br />', "\n", $origin [1]);
219
+        $origin  = str_replace(["\r\n", "\r"], "\n", $origin);
220
+        $origin  = explode("\n", highlight_string($origin , true));
221
+        $origin  = str_replace('<br />', "\n", $origin [1]);
222 222
 
223
-		$origin  = explode("\n", str_replace("\r\n", "\n", $origin));
223
+        $origin  = explode("\n", str_replace("\r\n", "\n", $origin));
224 224
 
225
-		// Get just the part to show
226
-		$start = $lineNumber - (int)round($lines / 2);
227
-		$start = $start < 0 ? 0 : $start;
225
+        // Get just the part to show
226
+        $start = $lineNumber - (int)round($lines / 2);
227
+        $start = $start < 0 ? 0 : $start;
228 228
 
229
-		// Get just the lines we need to display, while keeping line numbers...
230
-		$origin  = array_splice($origin, $start, $lines, true);
229
+        // Get just the lines we need to display, while keeping line numbers...
230
+        $origin  = array_splice($origin, $start, $lines, true);
231 231
 
232
-		// Used to format the line number in the source
233
-		$format = '% '.strlen($start + $lines).'d';
232
+        // Used to format the line number in the source
233
+        $format = '% '.strlen($start + $lines).'d';
234 234
 
235
-		$out = '';
236
-		// Because the highlighting may have an uneven number
237
-		// of open and close span tags on one line, we need
238
-		// to ensure we can close them all to get the lines
239
-		// showing correctly.
240
-		$spans = 1;
235
+        $out = '';
236
+        // Because the highlighting may have an uneven number
237
+        // of open and close span tags on one line, we need
238
+        // to ensure we can close them all to get the lines
239
+        // showing correctly.
240
+        $spans = 1;
241 241
 
242
-		foreach ($origin as $n => $row) {
243
-			$spans += substr_count($row, '<span') - substr_count($row, '</span');
244
-			$row = str_replace(["\r", "\n"], ['', ''], $row);
242
+        foreach ($origin as $n => $row) {
243
+            $spans += substr_count($row, '<span') - substr_count($row, '</span');
244
+            $row = str_replace(["\r", "\n"], ['', ''], $row);
245 245
 
246
-			if (($n+$start+1) == $lineNumber) {
247
-				preg_match_all('#<[^>]+>#', $row, $tags);
248
-				$out .= sprintf("<span class='line highlight'><span class='number'>{$format}</span> %s\n</span>%s",
249
-						$n + $start + 1,
250
-						strip_tags($row),
251
-						implode('', $tags[0])
252
-				);
253
-			} else {
254
-				$out .= sprintf('<span class="number">'.$format.'</span> %s <span class="line">', $n + $start +1, $row) ."\n";
255
-			}
256
-		}
246
+            if (($n+$start+1) == $lineNumber) {
247
+                preg_match_all('#<[^>]+>#', $row, $tags);
248
+                $out .= sprintf("<span class='line highlight'><span class='number'>{$format}</span> %s\n</span>%s",
249
+                        $n + $start + 1,
250
+                        strip_tags($row),
251
+                        implode('', $tags[0])
252
+                );
253
+            } else {
254
+                $out .= sprintf('<span class="number">'.$format.'</span> %s <span class="line">', $n + $start +1, $row) ."\n";
255
+            }
256
+        }
257 257
 
258
-		$out .= str_repeat('</span>', $spans);
258
+        $out .= str_repeat('</span>', $spans);
259 259
 
260
-		return '<pre class="code-blocks"><code>'.$out.'</code></pre>';
261
-	}
260
+        return '<pre class="code-blocks"><code>'.$out.'</code></pre>';
261
+    }
262 262
 
263
-	/**
264
-	 * Sets the variables to be passed to all templates rendered 
265
-	 * by this template helper.
266
-	 * 
267
-	 * @param  array  $variables
268
-	 * 
269
-	 * @return void
270
-	 */
271
-	public function setVariables(array $variables)
272
-	{
273
-		$this->variables = $variables;
274
-	}
263
+    /**
264
+     * Sets the variables to be passed to all templates rendered 
265
+     * by this template helper.
266
+     * 
267
+     * @param  array  $variables
268
+     * 
269
+     * @return void
270
+     */
271
+    public function setVariables(array $variables)
272
+    {
273
+        $this->variables = $variables;
274
+    }
275 275
 
276
-	/**
277
-	 * Convert a string to a slug version of itself.
278
-	 * 
279
-	 * @param  string  $original
280
-	 * 
281
-	 * @return string
282
-	 */
283
-	public function slug($original)
284
-	{
285
-		$slug = str_replace(" ", "-", $original);
286
-		$slug = preg_replace('/[^\w\d\-\_]/i',' ', $slug);
276
+    /**
277
+     * Convert a string to a slug version of itself.
278
+     * 
279
+     * @param  string  $original
280
+     * 
281
+     * @return string
282
+     */
283
+    public function slug($original)
284
+    {
285
+        $slug = str_replace(" ", "-", $original);
286
+        $slug = preg_replace('/[^\w\d\-\_]/i',' ', $slug);
287 287
 
288
-		return strtolower($slug);
289
-	}
288
+        return strtolower($slug);
289
+    }
290 290
 
291
-	/**
292
-	 * Given an exception and status code will display the error to the client.
293
-	 *
294
-	 * @param  string  $template
295
-	 * 
296
-	 * @return void
297
-	 */
298
-	public function render($template)
299
-	{
300
-		$vars = $this->getVariables();
291
+    /**
292
+     * Given an exception and status code will display the error to the client.
293
+     *
294
+     * @param  string  $template
295
+     * 
296
+     * @return void
297
+     */
298
+    public function render($template)
299
+    {
300
+        $vars = $this->getVariables();
301 301
 
302
-		$vars['template'] = $this;
302
+        $vars['template'] = $this;
303 303
 		
304
-		if ($this->system->getOutputBufferLevel() > $this->obLevel + 1) {
305
-			@$this->system->endOutputBuffering();
306
-		}
304
+        if ($this->system->getOutputBufferLevel() > $this->obLevel + 1) {
305
+            @$this->system->endOutputBuffering();
306
+        }
307 307
 
308
-		// Instantiate the error view and prepare the vars
309
-		call_user_func(function () {
310
-			extract(func_get_arg(1));
311
-			include func_get_arg(0);
312
-		}, $template, $vars);
313
-	}
308
+        // Instantiate the error view and prepare the vars
309
+        call_user_func(function () {
310
+            extract(func_get_arg(1));
311
+            include func_get_arg(0);
312
+        }, $template, $vars);
313
+    }
314 314
 }
315 315
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
 		if ($bytes < 1024) {
108 108
 			return $bytes.'B';
109 109
 		} else if ($bytes < 1048576) {
110
-			return round($bytes/1024, 2).'KB';
110
+			return round($bytes / 1024, 2).'KB';
111 111
 		}
112 112
 
113
-		return round($bytes/1048576, 2).'MB';
113
+		return round($bytes / 1048576, 2).'MB';
114 114
 	}
115 115
 	
116 116
 	/**
@@ -217,17 +217,17 @@  discard block
 block discarded – undo
217 217
 		}
218 218
 
219 219
 		$origin  = str_replace(["\r\n", "\r"], "\n", $origin);
220
-		$origin  = explode("\n", highlight_string($origin , true));
220
+		$origin  = explode("\n", highlight_string($origin, true));
221 221
 		$origin  = str_replace('<br />', "\n", $origin [1]);
222 222
 
223 223
 		$origin  = explode("\n", str_replace("\r\n", "\n", $origin));
224 224
 
225 225
 		// Get just the part to show
226
-		$start = $lineNumber - (int)round($lines / 2);
226
+		$start = $lineNumber - (int) round($lines / 2);
227 227
 		$start = $start < 0 ? 0 : $start;
228 228
 
229 229
 		// Get just the lines we need to display, while keeping line numbers...
230
-		$origin  = array_splice($origin, $start, $lines, true);
230
+		$origin = array_splice($origin, $start, $lines, true);
231 231
 
232 232
 		// Used to format the line number in the source
233 233
 		$format = '% '.strlen($start + $lines).'d';
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 			$spans += substr_count($row, '<span') - substr_count($row, '</span');
244 244
 			$row = str_replace(["\r", "\n"], ['', ''], $row);
245 245
 
246
-			if (($n+$start+1) == $lineNumber) {
246
+			if (($n + $start + 1) == $lineNumber) {
247 247
 				preg_match_all('#<[^>]+>#', $row, $tags);
248 248
 				$out .= sprintf("<span class='line highlight'><span class='number'>{$format}</span> %s\n</span>%s",
249 249
 						$n + $start + 1,
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 						implode('', $tags[0])
252 252
 				);
253 253
 			} else {
254
-				$out .= sprintf('<span class="number">'.$format.'</span> %s <span class="line">', $n + $start +1, $row) ."\n";
254
+				$out .= sprintf('<span class="number">'.$format.'</span> %s <span class="line">', $n + $start + 1, $row)."\n";
255 255
 			}
256 256
 		}
257 257
 
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 	public function slug($original)
284 284
 	{
285 285
 		$slug = str_replace(" ", "-", $original);
286
-		$slug = preg_replace('/[^\w\d\-\_]/i',' ', $slug);
286
+		$slug = preg_replace('/[^\w\d\-\_]/i', ' ', $slug);
287 287
 
288 288
 		return strtolower($slug);
289 289
 	}
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 		}
307 307
 
308 308
 		// Instantiate the error view and prepare the vars
309
-		call_user_func(function () {
309
+		call_user_func(function() {
310 310
 			extract(func_get_arg(1));
311 311
 			include func_get_arg(0);
312 312
 		}, $template, $vars);
Please login to merge, or discard this patch.
src/components/Debug/Benchmark.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@
 block discarded – undo
143 143
         $seconds  = (int) ($duration - $hours * 60 * 60 - $minutes * 60); 
144 144
         
145 145
         if ($seconds <= 0) {
146
-           return ' ms';
146
+            return ' ms';
147 147
         } elseif ($seconds > 0) {
148 148
             return ' s';
149 149
         }
Please login to merge, or discard this patch.
src/components/Filesystem/FileMimeType.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -30,61 +30,61 @@
 block discarded – undo
30 30
  */
31 31
 class FileMimeType
32 32
 {
33
-	/**
34
-	 * Map of extensions to mime types.
35
-	 *
36
-	 * @var array $mimes
37
-	 */
38
-	public static $mimes = [];
33
+    /**
34
+     * Map of extensions to mime types.
35
+     *
36
+     * @var array $mimes
37
+     */
38
+    public static $mimes = [];
39 39
 
40
-	/**
41
-	 * Constructor with an optional verification that the path is 
42
-	 * really a mimes.
43
-	 *
44
-	 * @return mixed
45
-	 */
46
-	public function __construct()
47
-	{
48
-		static::$mimes = (array) require CON_PATH.'mimes.php';
49
-	}
40
+    /**
41
+     * Constructor with an optional verification that the path is 
42
+     * really a mimes.
43
+     *
44
+     * @return mixed
45
+     */
46
+    public function __construct()
47
+    {
48
+        static::$mimes = (array) require CON_PATH.'mimes.php';
49
+    }
50 50
 
51
-	/**
52
-	 * Attempts to determine the best mime type for the given file extension.
53
-	 *
54
-	 * @param  string  $extension
55
-	 *
56
-	 * @return string|null  The mime type found, or none if unable to determine
57
-	 */
58
-	public static function guessTypeFromExtension($extension)
59
-	{
60
-		$extension = trim(strtolower($extension), '. ');
51
+    /**
52
+     * Attempts to determine the best mime type for the given file extension.
53
+     *
54
+     * @param  string  $extension
55
+     *
56
+     * @return string|null  The mime type found, or none if unable to determine
57
+     */
58
+    public static function guessTypeFromExtension($extension)
59
+    {
60
+        $extension = trim(strtolower($extension), '. ');
61 61
 
62
-		if ( ! array_key_exists($extension, static::$mimes)) {
63
-			return null;
64
-		}
62
+        if ( ! array_key_exists($extension, static::$mimes)) {
63
+            return null;
64
+        }
65 65
 		
66
-		return is_array(static::$mimes[$extension]) ? static::$mimes[$extension][0] : static::$mimes[$extension];
67
-	}
66
+        return is_array(static::$mimes[$extension]) ? static::$mimes[$extension][0] : static::$mimes[$extension];
67
+    }
68 68
 
69
-	/**
70
-	 * Attempts to determine the best file extension for a given mime type.
71
-	 *
72
-	 * @param  string  $type
73
-	 *
74
-	 * @return string|null The extension determined, or null if unable to match
75
-	 */
76
-	public static function guessExtensionFromType($type)
77
-	{
78
-		$type = trim(strtolower($type), '. ');
69
+    /**
70
+     * Attempts to determine the best file extension for a given mime type.
71
+     *
72
+     * @param  string  $type
73
+     *
74
+     * @return string|null The extension determined, or null if unable to match
75
+     */
76
+    public static function guessExtensionFromType($type)
77
+    {
78
+        $type = trim(strtolower($type), '. ');
79 79
 
80
-		foreach (static::$mimes as $ext => $types) {
81
-			if (is_string($types) && $types == $type) {
82
-				return $ext;
83
-			} elseif (is_array($types) && in_array($type, $types)) {
84
-				return $ext;
85
-			}
86
-		}
80
+        foreach (static::$mimes as $ext => $types) {
81
+            if (is_string($types) && $types == $type) {
82
+                return $ext;
83
+            } elseif (is_array($types) && in_array($type, $types)) {
84
+                return $ext;
85
+            }
86
+        }
87 87
 
88
-		return null;
89
-	}
88
+        return null;
89
+    }
90 90
 }
91 91
\ No newline at end of file
Please login to merge, or discard this patch.
src/components/Translation/TranslationServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
      */
39 39
     public function register()
40 40
     {
41
-        $this->app->singleton('translator', function () {            
41
+        $this->app->singleton('translator', function() {            
42 42
             $locale = $this->app['config']['app.locale'];
43 43
             
44 44
             return new Translator($locale);            
Please login to merge, or discard this patch.
src/components/Encryption/EncryptionServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function register()
42 42
     {
43
-        $this->app->singleton('encrypter', function ($app) {
43
+        $this->app->singleton('encrypter', function($app) {
44 44
             
45 45
             $config = $app->make('config')->get('security');
46 46
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      */
65 65
     protected function key(array $config)
66 66
     {
67
-        return take($config['key'], function ($key) {
67
+        return take($config['key'], function($key) {
68 68
             if (empty($key)) {
69 69
                 throw new RuntimeException('No application encryption key has been specified.');
70 70
             }            
Please login to merge, or discard this patch.
src/components/Encryption/Encrypter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
         if (static::supported($key, $cipher)) {
68 68
             $this->key    = $key;
69 69
             $this->cipher = $cipher;
70
-        } else   {
70
+        } else {
71 71
             throw new RuntimeException('The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.');
72 72
         }
73 73
         
Please login to merge, or discard this patch.
src/components/Database/Query/Grammar.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -198,15 +198,15 @@  discard block
 block discarded – undo
198 198
      */
199 199
     protected function compileWheres(Builder $builder)
200 200
     {
201
-       if (is_null($builder->wheres)) {
202
-           return '';
203
-       }
201
+        if (is_null($builder->wheres)) {
202
+            return '';
203
+        }
204 204
 
205
-       if (count($sql = $this->compileWheresToArray($builder)) > 0) {
205
+        if (count($sql = $this->compileWheresToArray($builder)) > 0) {
206 206
             return $this->concatenateWheresClauses($builder, $sql);
207
-       }
207
+        }
208 208
 
209
-       return '';
209
+        return '';
210 210
     }
211 211
 
212 212
     /**
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
      */
914 914
     public function compileUpdateWithoutJoins(Builder $builder, $table, $columns, $where)
915 915
     {
916
-       return "update {$table} set {$columns} {$where}";
916
+        return "update {$table} set {$columns} {$where}";
917 917
     }
918 918
 
919 919
     /**
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
      */
967 967
     public function compileDeleteWithoutJoins(Builder $builder, $table, $where)
968 968
     {
969
-       return "delete from {$table} {$where}";
969
+        return "delete from {$table} {$where}";
970 970
     }
971 971
 
972 972
     /**
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
             $clauses = [];
158 158
 
159
-            foreach ($join->clauses as $clause)  {
159
+            foreach ($join->clauses as $clause) {
160 160
                 $clauses[] = $this->compileJoinContraint($clause);
161 161
             }
162 162
 
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
      */
672 672
     protected function compileOrderToArray(Builder $builder, $orders)
673 673
     {
674
-        return array_map(function ($order) {
674
+        return array_map(function($order) {
675 675
             return $order['sql'] ?? $this->wrap($order['column']).' '.$order['direction'];
676 676
         }, $orders);
677 677
     }
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
      */
1004 1004
     protected function concatenate($segments)
1005 1005
     {
1006
-        return implode(' ', array_filter($segments, function ($value) {
1006
+        return implode(' ', array_filter($segments, function($value) {
1007 1007
             return (string) $value !== '';
1008 1008
         }));
1009 1009
     }
Please login to merge, or discard this patch.
src/components/Database/Query/Builder.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
     {
316 316
         $this->addSelect(new Expression($expression));
317 317
 
318
-        if (! empty($bindings)) {
318
+        if ( ! empty($bindings)) {
319 319
             $this->addBinding($bindings, 'select');
320 320
         }
321 321
 
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
      */
426 426
     protected function addArrayWheres($column, $boolean, $method = 'where')
427 427
     {
428
-        return $this->whereNested(function ($query) use ($column, $method, $boolean) {
428
+        return $this->whereNested(function($query) use ($column, $method, $boolean) {
429 429
             foreach ($column as $key => $value) {
430 430
                 if (is_numeric($key) && is_array($value)) {
431 431
                     $query->{$method}(...array_values($value));
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
      */
751 751
     public function get($columns = ['*'])
752 752
     {
753
-        return collect($this->getFresh(Arr::wrap($columns), function () {
753
+        return collect($this->getFresh(Arr::wrap($columns), function() {
754 754
             return $this->getWithStatement();
755 755
         }));
756 756
     }
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
 
881 881
         $this->columns = $previous;
882 882
 
883
-        if (isset($results[0]))  {
883
+        if (isset($results[0])) {
884 884
             $result = array_change_key((array) $results[0]);
885 885
         }
886 886
 
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
      */
1189 1189
     public function cleanBindings(array $bindings)
1190 1190
     {
1191
-        return array_values(array_filter($bindings, function ($binding) {
1191
+        return array_values(array_filter($bindings, function($binding) {
1192 1192
             return ! $binding instanceof Expression;
1193 1193
         }));
1194 1194
     }
Please login to merge, or discard this patch.