Skip to content

Commit cdd1741

Browse files
committed
improved coding style
1 parent e43a849 commit cdd1741

63 files changed

Lines changed: 338 additions & 334 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Bridges/Nette/TracyExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ public function afterCompile(Nette\PhpGenerator\ClassType $class)
8383
'$this->getService(?)->addPanel(?);',
8484
Nette\DI\Compiler::filterArguments([
8585
$this->prefix('bar'),
86-
is_string($item) ? new Nette\DI\Statement($item) : $item]
87-
)
86+
is_string($item) ? new Nette\DI\Statement($item) : $item,
87+
])
8888
));
8989
}
9090
}

src/Tracy/BlueScreen.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public static function highlightPhp($source, $line, $lines = 15, array $vars = N
115115
$out .= static::highlightLine($source, $line, $lines);
116116

117117
if ($vars) {
118-
$out = preg_replace_callback('#">\$(\w+)(&nbsp;)?</span>#', function($m) use ($vars) {
118+
$out = preg_replace_callback('#">\$(\w+)(&nbsp;)?</span>#', function ($m) use ($vars) {
119119
return array_key_exists($m[1], $vars)
120120
? '" title="'
121121
. str_replace('"', '&quot;', trim(strip_tags(Dumper::toHtml($vars[$m[1]], [Dumper::DEPTH => 1]))))
@@ -139,7 +139,7 @@ public static function highlightLine($html, $line, $lines = 15)
139139
$source = explode("\n", "\n" . str_replace("\r\n", "\n", $html));
140140
$out = '';
141141
$spans = 1;
142-
$start = $i = max(1, $line - floor($lines * 2/3));
142+
$start = $i = max(1, $line - floor($lines * 2 / 3));
143143
while (--$i >= 1) { // find last highlighted block
144144
if (preg_match('#.*(</?span[^>]*>)#', $source[$i], $m)) {
145145
if ($m[1] !== '</span>') {

src/Tracy/Debugger.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
namespace Tracy;
99

10-
use Tracy,
11-
ErrorException;
10+
use Tracy;
11+
use ErrorException;
1212

1313

1414
/**
@@ -266,7 +266,8 @@ public static function exceptionHandler($exception, $exit = TRUE)
266266
} catch (\Exception $e) {
267267
try {
268268
self::log($e, self::EXCEPTION);
269-
} catch (\Exception $e) {}
269+
} catch (\Exception $e) {
270+
}
270271
}
271272

272273
if ($exit) {
@@ -307,7 +308,8 @@ public static function errorHandler($severity, $message, $file, $line, $context)
307308
$e->context = $context;
308309
try {
309310
self::log($e, self::ERROR);
310-
} catch (\Exception $foo) {}
311+
} catch (\Exception $foo) {
312+
}
311313
return NULL;
312314

313315
} elseif (!self::$productionMode && !isset($_GET['_tracy_skip_error'])
@@ -328,7 +330,8 @@ public static function errorHandler($severity, $message, $file, $line, $context)
328330
} elseif (self::$productionMode) {
329331
try {
330332
self::log("$message in $file:$line", self::ERROR);
331-
} catch (\Exception $foo) {}
333+
} catch (\Exception $foo) {
334+
}
332335
return NULL;
333336

334337
} else {

src/Tracy/Dumper.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public static function toText($var, array $options = NULL)
127127
*/
128128
public static function toTerminal($var, array $options = NULL)
129129
{
130-
return htmlspecialchars_decode(strip_tags(preg_replace_callback('#<span class="tracy-dump-(\w+)">|</span>#', function($m) {
130+
return htmlspecialchars_decode(strip_tags(preg_replace_callback('#<span class="tracy-dump-(\w+)">|</span>#', function ($m) {
131131
return "\033[" . (isset($m[1], self::$terminalColors[$m[1]]) ? self::$terminalColors[$m[1]] : '0') . 'm';
132132
}, self::toHtml($var, $options))), ENT_QUOTES);
133133
}
@@ -280,7 +280,7 @@ private static function dumpResource(& $var, $options, $level)
280280
$out = "<span class=\"tracy-toggle tracy-collapsed\">$out</span>\n<div class=\"tracy-collapsed\">";
281281
foreach (call_user_func(self::$resources[$type], $var) as $k => $v) {
282282
$out .= '<span class="tracy-dump-indent"> ' . str_repeat('| ', $level) . '</span>'
283-
. '<span class="tracy-dump-key">' . htmlSpecialChars($k, ENT_IGNORE, 'UTF-8') . "</span> => " . self::dumpVar($v, $options, $level + 1);
283+
. '<span class="tracy-dump-key">' . htmlSpecialChars($k, ENT_IGNORE, 'UTF-8') . '</span> => ' . self::dumpVar($v, $options, $level + 1);
284284
}
285285
return $out . '</div>';
286286
}
@@ -397,7 +397,7 @@ public static function encodeString($s, $maxLength = NULL)
397397
foreach (array_merge(range("\x00", "\x1F"), range("\x7F", "\xFF")) as $ch) {
398398
$table[$ch] = '\x' . str_pad(dechex(ord($ch)), 2, '0', STR_PAD_LEFT);
399399
}
400-
$table["\\"] = '\\\\';
400+
$table['\\'] = '\\\\';
401401
$table["\r"] = '\r';
402402
$table["\n"] = '\n';
403403
$table["\t"] = '\t';
@@ -511,7 +511,8 @@ private static function findLocation()
511511
$location = $item;
512512
continue;
513513
}
514-
} catch (\ReflectionException $e) {}
514+
} catch (\ReflectionException $e) {
515+
}
515516
}
516517
break;
517518
}
@@ -522,7 +523,7 @@ private static function findLocation()
522523
return [
523524
$location['file'],
524525
$location['line'],
525-
trim(preg_match('#\w*dump(er::\w+)?\(.*\)#i', $line, $m) ? $m[0] : $line)
526+
trim(preg_match('#\w*dump(er::\w+)?\(.*\)#i', $line, $m) ? $m[0] : $line),
526527
];
527528
}
528529
}

src/Tracy/Helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static function editorUri($file, $line = NULL)
6060
public static function formatHtml($mask)
6161
{
6262
$args = func_get_args();
63-
return preg_replace_callback('#%#', function() use (& $args, & $count) {
63+
return preg_replace_callback('#%#', function () use (& $args, & $count) {
6464
return htmlspecialchars($args[++$count], ENT_IGNORE | ENT_QUOTES, 'UTF-8');
6565
}, $mask);
6666
}

src/Tracy/Logger.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ protected function formatLogLine($message, $exceptionFile = NULL)
113113
@date('[Y-m-d H-i-s]'),
114114
preg_replace('#\s*\r?\n\s*#', ' ', $this->formatMessage($message)),
115115
' @ ' . Helpers::getSource(),
116-
$exceptionFile ? ' @@ ' . basename($exceptionFile) : NULL
116+
$exceptionFile ? ' @@ ' . basename($exceptionFile) : NULL,
117117
]);
118118
}
119119

@@ -145,7 +145,7 @@ protected function logException($exception, $file = NULL)
145145
$file = $file ?: $this->getExceptionFile($exception);
146146
if ($handle = @fopen($file, 'x')) {
147147
ob_start(); // double buffer prevents sending HTTP headers in some PHP
148-
ob_start(function($buffer) use ($handle) { fwrite($handle, $buffer); }, 4096);
148+
ob_start(function ($buffer) use ($handle) { fwrite($handle, $buffer); }, 4096);
149149
$bs = $this->blueScreen ?: new BlueScreen;
150150
$bs->render($exception);
151151
ob_end_flush();
@@ -190,7 +190,7 @@ public function defaultMailer($message, $email)
190190
["\n", PHP_EOL],
191191
[
192192
'headers' => implode("\n", [
193-
"From: " . ($this->fromEmail ?: "noreply@$host"),
193+
'From: ' . ($this->fromEmail ?: "noreply@$host"),
194194
'X-Mailer: Tracy',
195195
'Content-Type: text/plain; charset=UTF-8',
196196
'Content-Transfer-Encoding: 8bit',

tests/Tracy.Bridges/TracyExtension.services.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* Test: TracyExtension accessors.
55
*/
66

7-
use Nette\DI,
8-
Tracy\Bridges\Nette\TracyExtension,
9-
Tester\Assert;
7+
use Nette\DI;
8+
use Tracy\Bridges\Nette\TracyExtension;
9+
use Tester\Assert;
1010

1111

1212
require __DIR__ . '/../bootstrap.php';

tests/Tracy/Debugger.Bar.html.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* @outputMatch %A%<!-- Tracy Debug Bar -->%A%
66
*/
77

8-
use Tracy\Debugger,
9-
Tester\Assert;
8+
use Tracy\Debugger;
9+
use Tester\Assert;
1010

1111

1212
require __DIR__ . '/../bootstrap.php';

tests/Tracy/Debugger.Bar.production.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* @outputMatch
66
*/
77

8-
use Tracy\Debugger,
9-
Tester\Assert;
8+
use Tracy\Debugger;
9+
use Tester\Assert;
1010

1111

1212
require __DIR__ . '/../bootstrap.php';

tests/Tracy/Debugger.Bar.text.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* @outputMatch
66
*/
77

8-
use Tracy\Debugger,
9-
Tester\Assert;
8+
use Tracy\Debugger;
9+
use Tester\Assert;
1010

1111

1212
require __DIR__ . '/../bootstrap.php';

0 commit comments

Comments
 (0)