update 1.0.8.0

Commits for version update
This commit is contained in:
Manish Verma
2016-10-17 12:02:27 +05:30
parent dec927987b
commit 76e85db070
9674 changed files with 495757 additions and 58922 deletions

View File

@@ -11,9 +11,9 @@
],
"require": {
"php": ">=5.5.9",
"illuminate/support": "5.1.*|5.2.*",
"illuminate/support": "5.1.*|5.2.*|5.3.*",
"symfony/finder": "~2.7|~3.0",
"maximebf/debugbar": "~1.11.0"
"maximebf/debugbar": "~1.11.0|~1.12.0"
},
"autoload": {
"psr-4": {

View File

@@ -1,6 +1,6 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
@@ -26,13 +26,13 @@ return array(
| can also be used. For PDO, run the package migrations first.
|
*/
'storage' => array(
'storage' => [
'enabled' => true,
'driver' => 'file', // redis, file, pdo, custom
'path' => storage_path('debugbar'), // For file driver
'connection' => null, // Leave null for default connection (Redis/PDO)
'provider' => '' // Instance of StorageInterface for custom driver
),
],
/*
|--------------------------------------------------------------------------
@@ -82,7 +82,7 @@ return array(
|
*/
'collectors' => array(
'collectors' => [
'phpinfo' => true, // Php version
'messages' => true, // Messages
'time' => true, // Time Datalogger
@@ -103,7 +103,7 @@ return array(
'auth' => false, // Display Laravel authentication status
'gate' => false, // Display Laravel Gate checks
'session' => true, // Display session data
),
],
/*
|--------------------------------------------------------------------------
@@ -114,33 +114,33 @@ return array(
|
*/
'options' => array(
'auth' => array(
'options' => [
'auth' => [
'show_name' => false, // Also show the users name/email in the debugbar
),
'db' => array(
],
'db' => [
'with_params' => true, // Render SQL with the parameters substituted
'timeline' => false, // Add the queries to the timeline
'backtrace' => false, // EXPERIMENTAL: Use a backtrace to find the origin of the query in your files.
'explain' => array( // EXPERIMENTAL: Show EXPLAIN output on queries
'explain' => [ // EXPERIMENTAL: Show EXPLAIN output on queries
'enabled' => false,
'types' => array('SELECT'), // array('SELECT', 'INSERT', 'UPDATE', 'DELETE'); for MySQL 5.6.3+
),
'types' => ['SELECT'], // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
],
'hints' => true, // Show hints for common mistakes
),
'mail' => array(
],
'mail' => [
'full_log' => false
),
'views' => array(
],
'views' => [
'data' => false, //Note: Can slow down the application, because the data can be quite large..
),
'route' => array(
],
'route' => [
'label' => true // show complete route on bar
),
'logs' => array(
],
'logs' => [
'file' => null
),
),
],
],
/*
|--------------------------------------------------------------------------
@@ -167,4 +167,4 @@ return array(
*/
'route_prefix' => '_debugbar',
);
];

View File

@@ -43,7 +43,7 @@ It also provides a Facade interface for easy logging Messages, Exceptions and Ti
Require this package with composer:
```
```shell
composer require barryvdh/laravel-debugbar
```
@@ -52,24 +52,23 @@ After updating composer, add the ServiceProvider to the providers array in confi
### Laravel 5.x:
```
```php
Barryvdh\Debugbar\ServiceProvider::class,
```
If you want to use the facade to log messages, add this to your facades in app.php:
```
```php
'Debugbar' => Barryvdh\Debugbar\Facade::class,
```
The profiler is enabled by default, if you have app.debug=true. You can override that in the config (`debugbar.enabled`). See more options in `config/debugbar.php`
You can also set in your config if you want to include/exclude the vendor files also (FontAwesome, Highlight.js and jQuery). If you already use them in your site, set it to false.
You can also only display the js of css vendors, by setting it to 'js' or 'css'. (Highlight.js requires both css + js, so set to `true` for syntax highlighting)
You can also only display the js or css vendors, by setting it to 'js' or 'css'. (Highlight.js requires both css + js, so set to `true` for syntax highlighting)
Copy the package config to your local config with the publish command:
```
```shell
php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"
```
@@ -77,7 +76,7 @@ php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"
For Lumen, register a different Provider in `bootstrap/app.php`:
```
```php
if (env('APP_DEBUG')) {
$app->register(Barryvdh\Debugbar\LumenServiceProvider::class);
}
@@ -85,7 +84,7 @@ if (env('APP_DEBUG')) {
To change the configuration, copy the file to your config folder and enable it:
```
```php
$app->configure('debugbar');
```
@@ -180,14 +179,14 @@ Add the following extensions to your TwigBridge config/extensions.php (or regist
The Dump extension will replace the [dump function](http://twig.sensiolabs.org/doc/functions/dump.html) to output variables using the DataFormatter. The Debug extension adds a `debug()` function which passes variables to the Message Collector,
instead of showing it directly in the template. It dumps the arguments, or when empty; all context variables.
```
```twig
{{ debug() }}
{{ debug(user, categories) }}
```
The Stopwatch extension adds a [stopwatch tag](http://symfony.com/blog/new-in-symfony-2-4-a-stopwatch-tag-for-twig) similar to the one in Symfony/Silex Twigbridge.
```
```twig
{% stopwatch "foo" %}
…some things that gets timed
{% endstopwatch %}

View File

@@ -16,9 +16,9 @@ class AssetController extends BaseController
$content = $renderer->dumpAssetsToString('js');
$response = new Response(
$content, 200, array(
$content, 200, [
'Content-Type' => 'text/javascript',
)
]
);
return $this->cacheResponse($response);
@@ -36,9 +36,9 @@ class AssetController extends BaseController
$content = $renderer->dumpAssetsToString('css');
$response = new Response(
$content, 200, array(
$content, 200, [
'Content-Type' => 'text/css',
)
]
);
return $this->cacheResponse($response);

View File

@@ -20,9 +20,9 @@ class OpenHandlerController extends BaseController
$data = $openHandler->handle(null, false, false);
return new Response(
$data, 200, array(
$data, 200, [
'Content-Type' => 'application/json'
)
]
);
}

View File

@@ -55,10 +55,10 @@ class AuthCollector extends DataCollector implements Renderable
{
// Defaults
if (is_null($user)) {
return array(
return [
'name' => 'Guest',
'user' => array('guest' => true),
);
'user' => ['guest' => true],
];
}
// The default auth identifer is the ID number, which isn't all that
@@ -75,10 +75,10 @@ class AuthCollector extends DataCollector implements Renderable
}
}
return array(
return [
'name' => $identifier,
'user' => $user instanceof Arrayable ? $user->toArray() : $user,
);
];
}
/**
@@ -94,21 +94,21 @@ class AuthCollector extends DataCollector implements Renderable
*/
public function getWidgets()
{
$widgets = array(
'auth' => array(
$widgets = [
'auth' => [
'icon' => 'lock',
'widget' => 'PhpDebugBar.Widgets.VariableListWidget',
'map' => 'auth.user',
'default' => '{}'
)
);
]
];
if ($this->showName) {
$widgets['auth.name'] = array(
$widgets['auth.name'] = [
'icon' => 'user',
'tooltip' => 'Auth status',
'map' => 'auth.name',
'default' => '',
);
];
}
return $widgets;
}

View File

@@ -69,12 +69,12 @@ class EventCollector extends TimeDataCollector
public function subscribe(Dispatcher $events)
{
$this->events = $events;
$events->listen('*', array($this, 'onWildcardEvent'));
$events->listen('*', [$this, 'onWildcardEvent']);
}
protected function prepareParams($params)
{
$data = array();
$data = [];
foreach ($params as $key => $value) {
if (is_object($value) && Str::is('Illuminate\*\Events\*', get_class($value))) {
$value = $this->prepareParams(get_object_vars($value));
@@ -100,17 +100,17 @@ class EventCollector extends TimeDataCollector
public function getWidgets()
{
return array(
"events" => array(
return [
"events" => [
"icon" => "tasks",
"widget" => "PhpDebugBar.Widgets.TimelineWidget",
"map" => "event",
"default" => "{}",
),
'events:badge' => array(
],
'events:badge' => [
'map' => 'event.nb_measures',
'default' => 0,
),
);
],
];
}
}

View File

@@ -29,8 +29,8 @@ class FilesCollector extends DataCollector implements Renderable
$files = $this->getIncludedFiles();
$compiled = $this->getCompiledFiles();
$included = array();
$alreadyCompiled = array();
$included = [];
$alreadyCompiled = [];
foreach ($files as $file) {
// Skip the files from Debugbar, they are only loaded for Debugging and confuse the output.
// Of course some files are stil always loaded (ServiceProvider, Facade etc)
@@ -41,27 +41,27 @@ class FilesCollector extends DataCollector implements Renderable
) {
continue;
} elseif (!in_array($file, $compiled)) {
$included[] = array(
$included[] = [
'message' => "'" . $this->stripBasePath($file) . "',",
// Use PHP syntax so we can copy-paste to compile config file.
'is_string' => true,
);
];
} else {
$alreadyCompiled[] = array(
$alreadyCompiled[] = [
'message' => "* '" . $this->stripBasePath($file) . "',",
// Mark with *, so know they are compiled anyways.
'is_string' => true,
);
];
}
}
// First the included files, then those that are going to be compiled.
$messages = array_merge($included, $alreadyCompiled);
return array(
return [
'messages' => $messages,
'count' => count($included),
);
];
}
/**
@@ -91,7 +91,7 @@ class FilesCollector extends DataCollector implements Renderable
return array_merge($core, $app['config']['compile']);
}
}
return array();
return [];
}
/**
@@ -111,18 +111,18 @@ class FilesCollector extends DataCollector implements Renderable
public function getWidgets()
{
$name = $this->getName();
return array(
"$name" => array(
return [
"$name" => [
"icon" => "files-o",
"widget" => "PhpDebugBar.Widgets.MessagesWidget",
"map" => "$name.messages",
"default" => "{}"
),
"$name:badge" => array(
],
"$name:badge" => [
"map" => "$name.count",
"default" => "null"
)
);
]
];
}
/**

View File

@@ -46,14 +46,14 @@ class IlluminateRouteCollector extends DataCollector implements Renderable
protected function getRouteInformation($route)
{
if (!is_a($route, 'Illuminate\Routing\Route')) {
return array();
return [];
}
$uri = head($route->methods()) . ' ' . $route->uri();
$action = $route->getAction();
$result = array(
$result = [
'uri' => $uri ?: '-',
);
];
$result = array_merge($result, $action);
@@ -109,21 +109,21 @@ class IlluminateRouteCollector extends DataCollector implements Renderable
*/
public function getWidgets()
{
$widgets = array(
"route" => array(
$widgets = [
"route" => [
"icon" => "share",
"widget" => "PhpDebugBar.Widgets.VariableListWidget",
"map" => "route",
"default" => "{}"
)
);
]
];
if (Config::get('debugbar.options.route.label', true)) {
$widgets['currentroute'] = array(
$widgets['currentroute'] = [
"icon" => "share",
"tooltip" => "Route",
"map" => "route.uri",
"default" => ""
);
];
}
return $widgets;
}

View File

@@ -27,11 +27,11 @@ class LaravelCollector extends DataCollector implements Renderable
// Fallback if not injected
$app = $this->app ?: app();
return array(
return [
"version" => $app::VERSION,
"environment" => $app->environment(),
"locale" => $app->getLocale(),
);
];
}
/**
@@ -47,25 +47,25 @@ class LaravelCollector extends DataCollector implements Renderable
*/
public function getWidgets()
{
return array(
"version" => array(
return [
"version" => [
"icon" => "github",
"tooltip" => "Version",
"map" => "laravel.version",
"default" => ""
),
"environment" => array(
],
"environment" => [
"icon" => "desktop",
"tooltip" => "Environment",
"map" => "laravel.environment",
"default" => ""
),
"locale" => array(
],
"locale" => [
"icon" => "flag",
"tooltip" => "Current locale",
"map" => "laravel.locale",
"default" => "",
),
);
],
];
}
}

View File

@@ -70,7 +70,7 @@ class LogsCollector extends MessagesCollector
$linecounter = $lines;
$pos = -2;
$beginning = false;
$text = array();
$text = [];
while ($linecounter > 0) {
$t = " ";
while ($t != "\n") {
@@ -111,12 +111,12 @@ class LogsCollector extends MessagesCollector
preg_match_all($pattern, $file, $headings);
$log_data = preg_split($pattern, $file);
$log = array();
$log = [];
foreach ($headings as $h) {
for ($i = 0, $j = count($h); $i < $j; $i++) {
foreach ($log_levels as $ll) {
if (strpos(strtolower($h[$i]), strtolower('.' . $ll))) {
$log[] = array('level' => $ll, 'header' => $h[$i], 'stack' => $log_data[$i]);
$log[] = ['level' => $ll, 'header' => $h[$i], 'stack' => $log_data[$i]];
}
}
}

View File

@@ -53,22 +53,22 @@ class MultiAuthCollector extends AuthCollector
*/
public function getWidgets()
{
$widgets = array(
"auth" => array(
$widgets = [
"auth" => [
"icon" => "lock",
"widget" => "PhpDebugBar.Widgets.VariableListWidget",
"map" => "auth.guards",
"default" => "{}"
)
);
]
];
if ($this->showName) {
$widgets['auth.name'] = array(
$widgets['auth.name'] = [
'icon' => 'user',
'tooltip' => 'Auth status',
'map' => 'auth.names',
'default' => '',
);
];
}
return $widgets;

View File

@@ -11,12 +11,13 @@ use DebugBar\DataCollector\TimeDataCollector;
class QueryCollector extends PDOCollector
{
protected $timeCollector;
protected $queries = array();
protected $queries = [];
protected $renderSqlWithParams = false;
protected $findSource = false;
protected $explainQuery = false;
protected $explainTypes = array('SELECT'); // array('SELECT', 'INSERT', 'UPDATE', 'DELETE'); for MySQL 5.6.3+
protected $explainTypes = ['SELECT']; // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
protected $showHints = false;
protected $reflection = [];
/**
* @param TimeDataCollector $timeCollector
@@ -80,7 +81,7 @@ class QueryCollector extends PDOCollector
*/
public function addQuery($query, $bindings, $time, $connection)
{
$explainResults = array();
$explainResults = [];
$time = $time / 1000;
$endTime = microtime(true);
$startTime = $endTime - $time;
@@ -98,8 +99,9 @@ class QueryCollector extends PDOCollector
$bindings = $this->checkBindings($bindings);
if (!empty($bindings) && $this->renderSqlWithParams) {
foreach ($bindings as $binding) {
$query = preg_replace('/\?/', $pdo->quote($binding), $query, 1);
foreach ($bindings as $key => $binding) {
$regex = is_numeric($key) ? '/\?/' : "/:{$key}/";
$query = preg_replace($regex, $pdo->quote($binding), $query, 1);
}
}
@@ -111,7 +113,7 @@ class QueryCollector extends PDOCollector
}
}
$this->queries[] = array(
$this->queries[] = [
'query' => $query,
'bindings' => $this->escapeBindings($bindings),
'time' => $time,
@@ -119,7 +121,7 @@ class QueryCollector extends PDOCollector
'explain' => $explainResults,
'connection' => $connection->getDatabaseName(),
'hints' => $this->showHints ? $hints : null,
);
];
if ($this->timeCollector !== null) {
$this->timeCollector->addMeasure($query, $startTime, $endTime);
@@ -171,7 +173,7 @@ class QueryCollector extends PDOCollector
*/
protected function performQueryAnalysis($query)
{
$hints = array();
$hints = [];
if (preg_match('/^\\s*SELECT\\s*`?[a-zA-Z0-9]*`?\\.?\\*/i', $query)) {
$hints[] = 'Use <code>SELECT *</code> only if you need all columns from table';
}
@@ -195,7 +197,7 @@ class QueryCollector extends PDOCollector
}
return implode("<br />", $hints);
}
/**
* Use a backtrace to search for the origin of the query.
*/
@@ -211,7 +213,13 @@ class QueryCollector extends PDOCollector
if (isset($trace['object']) && is_a($trace['object'], 'Twig_Template')) {
list($file, $line) = $this->getTwigInfo($trace);
} elseif (strpos($trace['file'], storage_path()) !== false) {
return 'Template file';
$hash = pathinfo($trace['file'], PATHINFO_FILENAME);
$line = isset($trace['line']) ? $trace['line'] : '?';
if ($name = $this->findViewFromHash($hash)) {
return 'view::' . $name . ':' . $line;
}
return 'view::' . $hash . ':' . $line;
} else {
$file = $trace['file'];
$line = isset($trace['line']) ? $trace['line'] : '?';
@@ -224,6 +232,32 @@ class QueryCollector extends PDOCollector
}
}
/**
* Find the template name from the hash.
*
* @param string $hash
* @return null|string
*/
protected function findViewFromHash($hash)
{
$finder = app('view')->getFinder();
if (isset($this->reflection['viewfinderViews'])) {
$property = $this->reflection['viewfinderViews'];
} else {
$reflection = new \ReflectionClass($finder);
$property = $reflection->getProperty('views');
$property->setAccessible(true);
$this->reflection['viewfinderViews'] = $property;
}
foreach ($property->getValue($finder) as $name => $path){
if (sha1($path) == $hash || md5($path) == $hash) {
return $name;
}
}
}
/**
* Get the filename/line from a Twig template trace
*
@@ -237,12 +271,12 @@ class QueryCollector extends PDOCollector
if (isset($trace['line'])) {
foreach ($trace['object']->getDebugInfo() as $codeLine => $templateLine) {
if ($codeLine <= $trace['line']) {
return array($file, $templateLine);
return [$file, $templateLine];
}
}
}
return array($file, -1);
return [$file, -1];
}
/**
@@ -258,13 +292,13 @@ class QueryCollector extends PDOCollector
}
return str_replace(base_path(), '', $path);
}
/**
* Reset the queries.
*/
public function reset()
{
$this->queries = array();
$this->queries = [];
}
/**
@@ -275,7 +309,7 @@ class QueryCollector extends PDOCollector
$totalTime = 0;
$queries = $this->queries;
$statements = array();
$statements = [];
foreach ($queries as $query) {
$totalTime += $query['time'];
@@ -284,33 +318,33 @@ class QueryCollector extends PDOCollector
$bindings['hints'] = $query['hints'];
}
$statements[] = array(
$statements[] = [
'sql' => $this->formatSql($query['query']),
'params' => (object) $bindings,
'duration' => $query['time'],
'duration_str' => $this->formatDuration($query['time']),
'stmt_id' => $query['source'],
'connection' => $query['connection'],
);
];
//Add the results from the explain as new rows
foreach($query['explain'] as $explain){
$statements[] = array(
$statements[] = [
'sql' => ' - EXPLAIN #' . $explain->id . ': `' . $explain->table . '` (' . $explain->select_type . ')',
'params' => $explain,
'row_count' => $explain->rows,
'stmt_id' => $explain->id,
);
];
}
}
$data = array(
$data = [
'nb_statements' => count($queries),
'nb_failed_statements' => 0,
'accumulated_duration' => $totalTime,
'accumulated_duration_str' => $this->formatDuration($totalTime),
'statements' => $statements
);
];
return $data;
}
@@ -338,17 +372,17 @@ class QueryCollector extends PDOCollector
*/
public function getWidgets()
{
return array(
"queries" => array(
return [
"queries" => [
"icon" => "inbox",
"widget" => "PhpDebugBar.Widgets.SQLQueriesWidget",
"map" => "queries",
"default" => "[]"
),
"queries:badge" => array(
],
"queries:badge" => [
"map" => "queries.nb_statements",
"default" => 0
)
);
]
];
}
}

View File

@@ -26,7 +26,7 @@ class SessionCollector extends DataCollector implements DataCollectorInterface,
*/
public function collect()
{
$data = array();
$data = [];
foreach ($this->session->all() as $key => $value) {
$data[$key] = is_string($value) ? $value : $this->formatVar($value);
}
@@ -46,13 +46,13 @@ class SessionCollector extends DataCollector implements DataCollectorInterface,
*/
public function getWidgets()
{
return array(
"session" => array(
return [
"session" => [
"icon" => "archive",
"widget" => "PhpDebugBar.Widgets.VariableListWidget",
"map" => "session",
"default" => "{}"
)
);
]
];
}
}

View File

@@ -48,14 +48,14 @@ class SymfonyRequestCollector extends DataCollector implements DataCollectorInte
*/
public function getWidgets()
{
return array(
"request" => array(
return [
"request" => [
"icon" => "tags",
"widget" => "PhpDebugBar.Widgets.VariableListWidget",
"map" => "request",
"default" => "{}"
)
);
]
];
}
/**
@@ -67,7 +67,7 @@ class SymfonyRequestCollector extends DataCollector implements DataCollectorInte
$response = $this->response;
$responseHeaders = $response->headers->all();
$cookies = array();
$cookies = [];
foreach ($response->headers->getCookies() as $cookie) {
$cookies[] = $this->getCookieHeader(
$cookie->getName(),
@@ -85,7 +85,7 @@ class SymfonyRequestCollector extends DataCollector implements DataCollectorInte
$statusCode = $response->getStatusCode();
$data = array(
$data = [
'format' => $request->getRequestFormat(),
'content_type' => $response->headers->get('Content-Type') ? $response->headers->get(
'Content-Type'
@@ -99,10 +99,10 @@ class SymfonyRequestCollector extends DataCollector implements DataCollectorInte
'request_cookies' => $request->cookies->all(),
'response_headers' => $responseHeaders,
'path_info' => $request->getPathInfo(),
);
];
if ($this->session) {
$sessionAttributes = array();
$sessionAttributes = [];
foreach ($this->session->all() as $key => $value) {
$sessionAttributes[$key] = $value;
}

View File

@@ -8,7 +8,7 @@ use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter;
class ViewCollector extends TwigCollector
{
protected $templates = array();
protected $templates = [];
protected $collect_data;
/**
@@ -20,7 +20,7 @@ class ViewCollector extends TwigCollector
{
$this->collect_data = $collectData;
$this->name = 'views';
$this->templates = array();
$this->templates = [];
$this->exporter = new ValueExporter();
}
@@ -31,18 +31,18 @@ class ViewCollector extends TwigCollector
public function getWidgets()
{
return array(
'views' => array(
return [
'views' => [
'icon' => 'leaf',
'widget' => 'PhpDebugBar.Widgets.TemplatesWidget',
'map' => 'views',
'default' => '[]'
),
'views:badge' => array(
],
'views:badge' => [
'map' => 'views.nb_templates',
'default' => 0
)
);
]
];
}
/**
@@ -73,28 +73,28 @@ class ViewCollector extends TwigCollector
if (!$this->collect_data) {
$params = array_keys($view->getData());
} else {
$data = array();
$data = [];
foreach ($view->getData() as $key => $value) {
$data[$key] = $this->exporter->exportValue($value);
}
$params = $data;
}
$this->templates[] = array(
$this->templates[] = [
'name' => $path ? sprintf('%s (%s)', $name, $path) : $name,
'param_count' => count($params),
'params' => $params,
'type' => $type,
);
];
}
public function collect()
{
$templates = $this->templates;
return array(
return [
'nb_templates' => count($templates),
'templates' => $templates,
);
];
}
}

View File

@@ -45,7 +45,7 @@ class JavascriptRenderer extends BaseJavascriptRenderer
'v' => $this->getModifiedTime('js')
]);
$html = "<link rel='stylesheet' type='text/css' href='{$cssRoute}'>";
$html = "<link rel='stylesheet' type='text/css' property='stylesheet' href='{$cssRoute}'>";
$html .= "<script type='text/javascript' src='{$jsRoute}'></script>";
if ($this->isJqueryNoConflictEnabled()) {
@@ -107,7 +107,7 @@ class JavascriptRenderer extends BaseJavascriptRenderer
}
if (is_array($uri)) {
$uris = array();
$uris = [];
foreach ($uri as $u) {
$uris[] = $this->makeUriRelativeTo($u, $root);
}

View File

@@ -640,16 +640,16 @@ class LaravelDebugbar extends DebugBar
/** @var Request $request */
$request = $this->app['request'];
$this->data = array(
'__meta' => array(
$this->data = [
'__meta' => [
'id' => $this->getCurrentRequestId(),
'datetime' => date('Y-m-d H:i:s'),
'utime' => microtime(true),
'method' => $request->getMethod(),
'uri' => $request->getRequestUri(),
'ip' => $request->getClientIp()
)
);
]
];
foreach ($this->collectors as $name => $collector) {
$this->data[$name] = $collector->collect();
@@ -752,16 +752,16 @@ class LaravelDebugbar extends DebugBar
return;
}
$this->data = array(
'__meta' => array(
$this->data = [
'__meta' => [
'id' => $this->getCurrentRequestId(),
'datetime' => date('Y-m-d H:i:s'),
'utime' => microtime(true),
'method' => 'CLI',
'uri' => isset($_SERVER['argv']) ? implode(' ', $_SERVER['argv']) : null,
'ip' => isset($_SERVER['SSH_CLIENT']) ? $_SERVER['SSH_CLIENT'] : null
)
);
]
];
foreach ($this->collectors as $name => $collector) {
$this->data[$name] = $collector->collect();
@@ -793,7 +793,7 @@ class LaravelDebugbar extends DebugBar
*/
public function __call($method, $args)
{
$messageLevels = array('emergency', 'alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug', 'log');
$messageLevels = ['emergency', 'alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug', 'log'];
if (in_array($method, $messageLevels)) {
foreach($args as $arg) {
$this->addMessage($arg, $method);

View File

@@ -52,6 +52,6 @@ class LumenServiceProvider extends ServiceProvider
*/
public function provides()
{
return array('debugbar', 'command.debugbar.clear');
return ['debugbar', 'command.debugbar.clear'];
}
}

View File

@@ -48,7 +48,7 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider
}
);
$this->commands(array('command.debugbar.clear'));
$this->commands(['command.debugbar.clear']);
}
/**
@@ -169,6 +169,6 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider
*/
public function provides()
{
return array('debugbar', 'command.debugbar.clear');
return ['debugbar', 'command.debugbar.clear'];
}
}

View File

@@ -85,7 +85,7 @@ class FilesystemStorage implements StorageInterface
/**
* {@inheritDoc}
*/
public function find(array $filters = array(), $max = 20, $offset = 0)
public function find(array $filters = [], $max = 20, $offset = 0)
{
// Sort by modified time, newest first
$sort = function (\SplFileInfo $a, \SplFileInfo $b) {
@@ -94,7 +94,7 @@ class FilesystemStorage implements StorageInterface
// Loop through .json files, filter the metadata and stop when max is found.
$i = 0;
$results = array();
$results = [];
foreach (Finder::create()->files()->name('*.json')->in($this->dirname)->sort($sort) as $file) {
if ($i++ < $offset && empty($filters)) {
$results[] = null;

View File

@@ -59,7 +59,7 @@ class ClockworkCollector extends DataCollector implements DataCollectorInterface
$request = $this->request;
$response = $this->response;
$data = array(
$data = [
'getData' => $request->query->all(),
'postData' => $request->request->all(),
'headers' => $request->headers->all(),
@@ -67,10 +67,10 @@ class ClockworkCollector extends DataCollector implements DataCollectorInterface
'uri' => $request->getRequestUri(),
'method' => $request->getMethod(),
'responseStatus' => $response->getStatusCode(),
);
];
if ($this->session) {
$sessionAttributes = array();
$sessionAttributes = [];
foreach ($this->session->all() as $key => $value) {
$sessionAttributes[$key] = $value;
}

View File

@@ -42,11 +42,11 @@ class Debug extends Twig_Extension
*/
public function getFunctions()
{
return array(
return [
new Twig_SimpleFunction(
'debug', [$this, 'debug'], array('needs_context' => true, 'needs_environment' => true)
'debug', [$this, 'debug'], ['needs_context' => true, 'needs_environment' => true]
),
);
];
}
/**
@@ -64,7 +64,7 @@ class Debug extends Twig_Extension
$count = func_num_args();
if (2 === $count) {
$data = array();
$data = [];
foreach ($context as $key => $value) {
if (is_object($value)) {
if (method_exists($value, 'toArray')) {

View File

@@ -38,11 +38,11 @@ class Dump extends Twig_Extension
*/
public function getFunctions()
{
return array(
return [
new Twig_SimpleFunction(
'dump', [$this, 'dump'], array('is_safe' => ['html'], 'needs_context' => true, 'needs_environment' => true)
'dump', [$this, 'dump'], ['is_safe' => ['html'], 'needs_context' => true, 'needs_environment' => true]
),
);
];
}
/**
@@ -60,7 +60,7 @@ class Dump extends Twig_Extension
$count = func_num_args();
if (2 === $count) {
$data = array();
$data = [];
foreach ($context as $key => $value) {
if (is_object($value)) {
if (method_exists($value, 'toArray')) {

View File

@@ -39,14 +39,14 @@ class Stopwatch extends Twig_Extension
public function getTokenParsers()
{
return array(
return [
/*
* {% stopwatch foo %}
* Some stuff which will be recorded on the timeline
* {% endstopwatch %}
*/
new StopwatchTokenParser($this->debugbar !== null),
);
];
}
public function getDebugbar()

View File

@@ -14,7 +14,7 @@ class StopwatchNode extends \Twig_Node
$lineno = 0,
$tag = null
) {
parent::__construct(array('body' => $body, 'name' => $name, 'var' => $var), array(), $lineno, $tag);
parent::__construct(['body' => $body, 'name' => $name, 'var' => $var], [], $lineno, $tag);
}
public function compile(\Twig_Compiler $compiler)

View File

@@ -27,7 +27,7 @@ class StopwatchTokenParser extends \Twig_TokenParser
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
// {% endstopwatch %}
$body = $this->parser->subparse(array($this, 'decideStopwatchEnd'), true);
$body = $this->parser->subparse([$this, 'decideStopwatchEnd'], true);
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
if ($this->debugbarAvailable) {