1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-21 00:26:10 +02:00
This commit is contained in:
Jordi Boggiano
2016-05-26 20:54:06 +01:00
parent 85e43a5e7b
commit f200e79879
115 changed files with 1138 additions and 1123 deletions

View File

@@ -22,7 +22,7 @@ use Monolog\Formatter\FormatterInterface;
class BrowserConsoleHandler extends AbstractProcessingHandler
{
protected static $initialized = false;
protected static $records = array();
protected static $records = [];
/**
* {@inheritDoc}
@@ -79,7 +79,7 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
*/
public static function reset()
{
self::$records = array();
self::$records = [];
}
/**
@@ -88,7 +88,7 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
protected function registerShutdownFunction()
{
if (PHP_SAPI !== 'cli') {
register_shutdown_function(array('Monolog\Handler\BrowserConsoleHandler', 'send'));
register_shutdown_function(['Monolog\Handler\BrowserConsoleHandler', 'send']);
}
}
@@ -133,7 +133,7 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
private static function generateScript()
{
$script = array();
$script = [];
foreach (self::$records as $record) {
$context = self::dump('Context', $record['context']);
$extra = self::dump('Extra', $record['extra']);
@@ -142,10 +142,10 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
$script[] = self::call_array('log', self::handleStyles($record['formatted']));
} else {
$script = array_merge($script,
array(self::call_array('groupCollapsed', self::handleStyles($record['formatted']))),
[self::call_array('groupCollapsed', self::handleStyles($record['formatted']))],
$context,
$extra,
array(self::call('groupEnd'))
[self::call('groupEnd')]
);
}
}
@@ -155,7 +155,7 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
private static function handleStyles($formatted)
{
$args = array(self::quote('font-weight: normal'));
$args = [self::quote('font-weight: normal')];
$format = '%c' . $formatted;
preg_match_all('/\[\[(.*?)\]\]\{([^}]*)\}/s', $format, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER);
@@ -174,8 +174,8 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
private static function handleCustomStyles($style, $string)
{
static $colors = array('blue', 'green', 'red', 'magenta', 'orange', 'black', 'grey');
static $labels = array();
static $colors = ['blue', 'green', 'red', 'magenta', 'orange', 'black', 'grey'];
static $labels = [];
return preg_replace_callback('/macro\s*:(.*?)(?:;|$)/', function ($m) use ($string, &$colors, &$labels) {
if (trim($m[1]) === 'autolabel') {
@@ -194,7 +194,7 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
private static function dump($title, array $dict)
{
$script = array();
$script = [];
$dict = array_filter($dict);
if (empty($dict)) {
return $script;