PSR-12 + action (#1087)
This commit is contained in:
parent
5d11919868
commit
51c8ea3ab2
|
@ -37,3 +37,36 @@ jobs:
|
||||||
|
|
||||||
- name: Execute Unit Tests
|
- name: Execute Unit Tests
|
||||||
run: composer test
|
run: composer test
|
||||||
|
|
||||||
|
fix-style:
|
||||||
|
name: Fix Code Style
|
||||||
|
timeout-minutes: 15
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
COMPOSER_NO_INTERACTION: 1
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: 7.4
|
||||||
|
coverage: none
|
||||||
|
tools: composer:v2
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
composer update --prefer-dist --no-suggest --no-progress
|
||||||
|
|
||||||
|
- run: composer fix-style
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
# Revert modifications so they don't get commited 💥
|
||||||
|
- run: git checkout -- composer.json
|
||||||
|
|
||||||
|
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
|
with:
|
||||||
|
commit_message: composer fix-style
|
||||||
|
commit_author: laravel-debugbar <laravel-debugbar@users.noreply.github.com>
|
|
@ -52,8 +52,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"check-style": "phpcs -p --standard=PSR12 config/ resources/ src/ tests/",
|
"check-style": "phpcs -p --standard=PSR12 config/ src/ tests/",
|
||||||
"fix-style": "phpcbf -p --standard=PSR12 config/ resources/ src/ tests/",
|
"fix-style": "phpcbf -p --standard=PSR12 config/ src/ tests/",
|
||||||
"test": "phpunit"
|
"test": "phpunit"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ return [
|
||||||
'timeline' => false, // Add the queries to the timeline
|
'timeline' => false, // Add the queries to the timeline
|
||||||
'explain' => [ // Show EXPLAIN output on queries
|
'explain' => [ // Show EXPLAIN output on queries
|
||||||
'enabled' => false,
|
'enabled' => false,
|
||||||
'types' => ['SELECT'], // // workaround ['SELECT'] only. https://github.com/barryvdh/laravel-debugbar/issues/888 ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
|
'types' => ['SELECT'], // Deprecated setting, is always only SELECT
|
||||||
],
|
],
|
||||||
'hints' => false, // Show hints for common mistakes
|
'hints' => false, // Show hints for common mistakes
|
||||||
'show_copy' => false, // Show copy button next to the query
|
'show_copy' => false, // Show copy button next to the query
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
@ -27,7 +28,7 @@ class CreatePhpdebugbarStorageTable extends Migration
|
||||||
$table->index('meta_uri');
|
$table->index('meta_uri');
|
||||||
$table->index('meta_ip');
|
$table->index('meta_ip');
|
||||||
$table->index('meta_method');
|
$table->index('meta_method');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
|
@ -1,4 +1,6 @@
|
||||||
<?php namespace Barryvdh\Debugbar\Console;
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar\Console;
|
||||||
|
|
||||||
use DebugBar\DebugBar;
|
use DebugBar\DebugBar;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
@ -21,12 +23,11 @@ class ClearCommand extends Command
|
||||||
$this->debugbar->boot();
|
$this->debugbar->boot();
|
||||||
|
|
||||||
if ($storage = $this->debugbar->getStorage()) {
|
if ($storage = $this->debugbar->getStorage()) {
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$storage->clear();
|
$storage->clear();
|
||||||
} catch(\InvalidArgumentException $e) {
|
} catch (\InvalidArgumentException $e) {
|
||||||
// hide InvalidArgumentException if storage location does not exist
|
// hide InvalidArgumentException if storage location does not exist
|
||||||
if(strpos($e->getMessage(), 'does not exist') === false) {
|
if (strpos($e->getMessage(), 'does not exist') === false) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?php namespace Barryvdh\Debugbar\Controllers;
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar\Controllers;
|
||||||
|
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
|
@ -16,7 +18,9 @@ class AssetController extends BaseController
|
||||||
$content = $renderer->dumpAssetsToString('js');
|
$content = $renderer->dumpAssetsToString('js');
|
||||||
|
|
||||||
$response = new Response(
|
$response = new Response(
|
||||||
$content, 200, [
|
$content,
|
||||||
|
200,
|
||||||
|
[
|
||||||
'Content-Type' => 'text/javascript',
|
'Content-Type' => 'text/javascript',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -36,7 +40,9 @@ class AssetController extends BaseController
|
||||||
$content = $renderer->dumpAssetsToString('css');
|
$content = $renderer->dumpAssetsToString('css');
|
||||||
|
|
||||||
$response = new Response(
|
$response = new Response(
|
||||||
$content, 200, [
|
$content,
|
||||||
|
200,
|
||||||
|
[
|
||||||
'Content-Type' => 'text/css',
|
'Content-Type' => 'text/css',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
<?php namespace Barryvdh\Debugbar\Controllers;
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar\Controllers;
|
||||||
|
|
||||||
use Barryvdh\Debugbar\LaravelDebugbar;
|
use Barryvdh\Debugbar\LaravelDebugbar;
|
||||||
use Illuminate\Routing\Controller;
|
use Illuminate\Routing\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Laravel\Telescope\Telescope;
|
use Laravel\Telescope\Telescope;
|
||||||
|
|
||||||
|
// phpcs:ignoreFile
|
||||||
if (class_exists('Illuminate\Routing\Controller')) {
|
if (class_exists('Illuminate\Routing\Controller')) {
|
||||||
|
|
||||||
class BaseController extends Controller
|
class BaseController extends Controller
|
||||||
|
@ -15,7 +18,7 @@ if (class_exists('Illuminate\Routing\Controller')) {
|
||||||
{
|
{
|
||||||
$this->debugbar = $debugbar;
|
$this->debugbar = $debugbar;
|
||||||
|
|
||||||
if ($request->hasSession()){
|
if ($request->hasSession()) {
|
||||||
$request->session()->reflash();
|
$request->session()->reflash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +41,7 @@ if (class_exists('Illuminate\Routing\Controller')) {
|
||||||
{
|
{
|
||||||
$this->debugbar = $debugbar;
|
$this->debugbar = $debugbar;
|
||||||
|
|
||||||
if ($request->hasSession()){
|
if ($request->hasSession()) {
|
||||||
$request->session()->reflash();
|
$request->session()->reflash();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?php namespace Barryvdh\Debugbar\Controllers;
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar\Controllers;
|
||||||
|
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
|
@ -23,5 +25,4 @@ class CacheController extends BaseController
|
||||||
|
|
||||||
return response()->json(compact('success'));
|
return response()->json(compact('success'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?php namespace Barryvdh\Debugbar\Controllers;
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar\Controllers;
|
||||||
|
|
||||||
use Barryvdh\Debugbar\Support\Clockwork\Converter;
|
use Barryvdh\Debugbar\Support\Clockwork\Converter;
|
||||||
use DebugBar\OpenHandler;
|
use DebugBar\OpenHandler;
|
||||||
|
@ -13,7 +15,9 @@ class OpenHandlerController extends BaseController
|
||||||
$data = $openHandler->handle(null, false, false);
|
$data = $openHandler->handle(null, false, false);
|
||||||
|
|
||||||
return new Response(
|
return new Response(
|
||||||
$data, 200, [
|
$data,
|
||||||
|
200,
|
||||||
|
[
|
||||||
'Content-Type' => 'application/json'
|
'Content-Type' => 'application/json'
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?php namespace Barryvdh\Debugbar\Controllers;
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar\Controllers;
|
||||||
|
|
||||||
use Barryvdh\Debugbar\Support\Clockwork\Converter;
|
use Barryvdh\Debugbar\Support\Clockwork\Converter;
|
||||||
use DebugBar\OpenHandler;
|
use DebugBar\OpenHandler;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Barryvdh\Debugbar\DataCollector;
|
namespace Barryvdh\Debugbar\DataCollector;
|
||||||
|
|
||||||
use DebugBar\DataCollector\TimeDataCollector;
|
use DebugBar\DataCollector\TimeDataCollector;
|
||||||
|
@ -22,7 +23,7 @@ class CacheCollector extends TimeDataCollector
|
||||||
KeyForgotten::class => 'forgotten',
|
KeyForgotten::class => 'forgotten',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct($requestStartTime = null, $collectValues)
|
public function __construct($requestStartTime, $collectValues)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Barryvdh\Debugbar\DataCollector;
|
namespace Barryvdh\Debugbar\DataCollector;
|
||||||
|
|
||||||
use Barryvdh\Debugbar\DataFormatter\SimpleFormatter;
|
use Barryvdh\Debugbar\DataFormatter\SimpleFormatter;
|
||||||
|
@ -29,7 +30,6 @@ class EventCollector extends TimeDataCollector
|
||||||
|
|
||||||
// Find all listeners for the current event
|
// Find all listeners for the current event
|
||||||
foreach ($this->events->getListeners($name) as $i => $listener) {
|
foreach ($this->events->getListeners($name) as $i => $listener) {
|
||||||
|
|
||||||
// Check if it's an object + method name
|
// Check if it's an object + method name
|
||||||
if (is_array($listener) && count($listener) > 1 && is_object($listener[0])) {
|
if (is_array($listener) && count($listener) > 1 && is_object($listener[0])) {
|
||||||
list($class, $method) = $listener;
|
list($class, $method) = $listener;
|
||||||
|
@ -53,7 +53,8 @@ class EventCollector extends TimeDataCollector
|
||||||
|
|
||||||
// Format the closure to a readable format
|
// Format the closure to a readable format
|
||||||
$filename = ltrim(str_replace(base_path(), '', $reflector->getFileName()), '/');
|
$filename = ltrim(str_replace(base_path(), '', $reflector->getFileName()), '/');
|
||||||
$listener = $reflector->getName() . ' (' . $filename . ':' . $reflector->getStartLine() . '-' . $reflector->getEndLine() . ')';
|
$lines = $reflector->getStartLine() . '-' . $reflector->getEndLine();
|
||||||
|
$listener = $reflector->getName() . ' (' . $filename . ':' . $lines . ')';
|
||||||
} else {
|
} else {
|
||||||
// Not sure if this is possible, but to prevent edge cases
|
// Not sure if this is possible, but to prevent edge cases
|
||||||
$listener = $this->getDataFormatter()->formatVar($listener);
|
$listener = $this->getDataFormatter()->formatVar($listener);
|
||||||
|
|
|
@ -34,7 +34,8 @@ class FilesCollector extends DataCollector implements Renderable
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
// Skip the files from Debugbar, they are only loaded for Debugging and confuse the output.
|
// 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)
|
// Of course some files are stil always loaded (ServiceProvider, Facade etc)
|
||||||
if (strpos($file, 'vendor/maximebf/debugbar/src') !== false || strpos(
|
if (
|
||||||
|
strpos($file, 'vendor/maximebf/debugbar/src') !== false || strpos(
|
||||||
$file,
|
$file,
|
||||||
'vendor/barryvdh/laravel-debugbar/src'
|
'vendor/barryvdh/laravel-debugbar/src'
|
||||||
) !== false
|
) !== false
|
||||||
|
|
|
@ -22,12 +22,12 @@ class GateCollector extends MessagesCollector
|
||||||
{
|
{
|
||||||
parent::__construct('gate');
|
parent::__construct('gate');
|
||||||
$this->setDataFormatter(new SimpleFormatter());
|
$this->setDataFormatter(new SimpleFormatter());
|
||||||
$gate->after(function ($user = null, $ability, $result, $arguments = []) {
|
$gate->after(function ($user, $ability, $result, $arguments = []) {
|
||||||
$this->addCheck($user, $ability, $result, $arguments);
|
$this->addCheck($user, $ability, $result, $arguments);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addCheck($user = null, $ability, $result, $arguments = [])
|
public function addCheck($user, $ability, $result, $arguments = [])
|
||||||
{
|
{
|
||||||
$userKey = 'user';
|
$userKey = 'user';
|
||||||
$userId = null;
|
$userId = null;
|
||||||
|
|
|
@ -23,12 +23,12 @@ class LivewireCollector extends DataCollector implements DataCollectorInterface,
|
||||||
public function __construct(Request $request)
|
public function __construct(Request $request)
|
||||||
{
|
{
|
||||||
// Listen to Livewire views
|
// Listen to Livewire views
|
||||||
Livewire::listen('view:render', function(View $view) use ($request) {
|
Livewire::listen('view:render', function (View $view) use ($request) {
|
||||||
/** @var \Livewire\Component $component */
|
/** @var \Livewire\Component $component */
|
||||||
$component = $view->getData()['_instance'];
|
$component = $view->getData()['_instance'];
|
||||||
|
|
||||||
// Create an unique name for each compoent
|
// Create an unique name for each compoent
|
||||||
$key = $component->getName() . ' #' .$component->id;
|
$key = $component->getName() . ' #' . $component->id;
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'data' => $component->getPublicPropertiesDefinedBySubClass(),
|
'data' => $component->getPublicPropertiesDefinedBySubClass(),
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Barryvdh\Debugbar\DataCollector;
|
namespace Barryvdh\Debugbar\DataCollector;
|
||||||
|
|
||||||
use DebugBar\DataCollector\MessagesCollector;
|
use DebugBar\DataCollector\MessagesCollector;
|
||||||
|
|
|
@ -11,7 +11,6 @@ use Illuminate\Contracts\Auth\Guard;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Illuminate\Contracts\Support\Arrayable;
|
use Illuminate\Contracts\Support\Arrayable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collector for Laravel's Auth provider
|
* Collector for Laravel's Auth provider
|
||||||
*/
|
*/
|
||||||
|
@ -55,13 +54,13 @@ class MultiAuthCollector extends DataCollector implements Renderable
|
||||||
];
|
];
|
||||||
$names = '';
|
$names = '';
|
||||||
|
|
||||||
foreach($this->guards as $guardName => $config) {
|
foreach ($this->guards as $guardName => $config) {
|
||||||
try {
|
try {
|
||||||
$guard = $this->auth->guard($guardName);
|
$guard = $this->auth->guard($guardName);
|
||||||
if ($this->hasUser($guard)) {
|
if ($this->hasUser($guard)) {
|
||||||
$user = $guard->user();
|
$user = $guard->user();
|
||||||
|
|
||||||
if(!is_null($user)) {
|
if (!is_null($user)) {
|
||||||
$data['guards'][$guardName] = $this->getUserInformation($user);
|
$data['guards'][$guardName] = $this->getUserInformation($user);
|
||||||
$names .= $guardName . ": " . $data['guards'][$guardName]['name'] . ', ';
|
$names .= $guardName . ": " . $data['guards'][$guardName]['name'] . ', ';
|
||||||
}
|
}
|
||||||
|
@ -166,5 +165,4 @@ class MultiAuthCollector extends DataCollector implements Renderable
|
||||||
|
|
||||||
return $widgets;
|
return $widgets;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Barryvdh\Debugbar\DataCollector;
|
namespace Barryvdh\Debugbar\DataCollector;
|
||||||
|
|
||||||
use DebugBar\DataCollector\PhpInfoCollector as DebugBarPhpInfoCollector;
|
use DebugBar\DataCollector\PhpInfoCollector as DebugBarPhpInfoCollector;
|
||||||
|
|
|
@ -126,7 +126,7 @@ class QueryCollector extends PDOCollector
|
||||||
$bindings = $connection->prepareBindings($bindings);
|
$bindings = $connection->prepareBindings($bindings);
|
||||||
|
|
||||||
// Run EXPLAIN on this query (if needed)
|
// Run EXPLAIN on this query (if needed)
|
||||||
if ($this->explainQuery && $pdo && preg_match('/^\s*('.implode('|', $this->explainTypes).') /i', $query)) {
|
if ($this->explainQuery && $pdo && preg_match('/^\s*(' . implode('|', $this->explainTypes) . ') /i', $query)) {
|
||||||
$statement = $pdo->prepare('EXPLAIN ' . $query);
|
$statement = $pdo->prepare('EXPLAIN ' . $query);
|
||||||
$statement->execute($bindings);
|
$statement->execute($bindings);
|
||||||
$explainResults = $statement->fetchAll(\PDO::FETCH_CLASS);
|
$explainResults = $statement->fetchAll(\PDO::FETCH_CLASS);
|
||||||
|
@ -210,6 +210,7 @@ class QueryCollector extends PDOCollector
|
||||||
*/
|
*/
|
||||||
protected function performQueryAnalysis($query)
|
protected function performQueryAnalysis($query)
|
||||||
{
|
{
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
$hints = [];
|
$hints = [];
|
||||||
if (preg_match('/^\\s*SELECT\\s*`?[a-zA-Z0-9]*`?\\.?\\*/i', $query)) {
|
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';
|
$hints[] = 'Use <code>SELECT *</code> only if you need all columns from table';
|
||||||
|
@ -229,10 +230,12 @@ class QueryCollector extends PDOCollector
|
||||||
$hints[] = '<code>LIMIT</code> without <code>ORDER BY</code> causes non-deterministic results, depending on the query execution plan';
|
$hints[] = '<code>LIMIT</code> without <code>ORDER BY</code> causes non-deterministic results, depending on the query execution plan';
|
||||||
}
|
}
|
||||||
if (preg_match('/LIKE\\s[\'"](%.*?)[\'"]/i', $query, $matches)) {
|
if (preg_match('/LIKE\\s[\'"](%.*?)[\'"]/i', $query, $matches)) {
|
||||||
$hints[] = 'An argument has a leading wildcard character: <code>' . $matches[1]. '</code>.
|
$hints[] = 'An argument has a leading wildcard character: <code>' . $matches[1] . '</code>.
|
||||||
The predicate with this argument is not sargable and cannot use an index if one exists.';
|
The predicate with this argument is not sargable and cannot use an index if one exists.';
|
||||||
}
|
}
|
||||||
return $hints;
|
return $hints;
|
||||||
|
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -275,7 +278,8 @@ class QueryCollector extends PDOCollector
|
||||||
return $frame;
|
return $frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($trace['class']) &&
|
if (
|
||||||
|
isset($trace['class']) &&
|
||||||
isset($trace['file']) &&
|
isset($trace['file']) &&
|
||||||
!$this->fileIsInExcludedPath($trace['file'])
|
!$this->fileIsInExcludedPath($trace['file'])
|
||||||
) {
|
) {
|
||||||
|
@ -369,7 +373,7 @@ class QueryCollector extends PDOCollector
|
||||||
$this->reflection['viewfinderViews'] = $property;
|
$this->reflection['viewfinderViews'] = $property;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($property->getValue($finder) as $name => $path){
|
foreach ($property->getValue($finder) as $name => $path) {
|
||||||
if (sha1($path) == $hash || md5($path) == $hash) {
|
if (sha1($path) == $hash || md5($path) == $hash) {
|
||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
|
@ -476,9 +480,9 @@ class QueryCollector extends PDOCollector
|
||||||
];
|
];
|
||||||
|
|
||||||
//Add the results from the explain as new rows
|
//Add the results from the explain as new rows
|
||||||
foreach($query['explain'] as $explain){
|
foreach ($query['explain'] as $explain) {
|
||||||
$statements[] = [
|
$statements[] = [
|
||||||
'sql' => ' - EXPLAIN #' . $explain->id . ': `' . $explain->table . '` (' . $explain->select_type . ')',
|
'sql' => " - EXPLAIN # {$explain->id}: `{$explain->table}` ({$explain->select_type})",
|
||||||
'type' => 'explain',
|
'type' => 'explain',
|
||||||
'params' => $explain,
|
'params' => $explain,
|
||||||
'row_count' => $explain->rows,
|
'row_count' => $explain->rows,
|
||||||
|
|
|
@ -30,7 +30,7 @@ class RequestCollector extends DataCollector implements DataCollectorInterface,
|
||||||
* Create a new SymfonyRequestCollector
|
* Create a new SymfonyRequestCollector
|
||||||
*
|
*
|
||||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||||
* @param \Symfony\Component\HttpFoundation\Request $response
|
* @param \Symfony\Component\HttpFoundation\Response $response
|
||||||
* @param \Symfony\Component\HttpFoundation\Session\SessionInterface $session
|
* @param \Symfony\Component\HttpFoundation\Session\SessionInterface $session
|
||||||
*/
|
*/
|
||||||
public function __construct($request, $response, $session = null, $currentRequestId = null)
|
public function __construct($request, $response, $session = null, $currentRequestId = null)
|
||||||
|
@ -116,8 +116,10 @@ class RequestCollector extends DataCollector implements DataCollectorInterface,
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($data['request_server'] as $key => $value) {
|
foreach ($data['request_server'] as $key => $value) {
|
||||||
if (Str::is('*_KEY', $key) || Str::is('*_PASSWORD', $key)
|
if (
|
||||||
|| Str::is('*_SECRET', $key) || Str::is('*_PW', $key)) {
|
Str::is('*_KEY', $key) || Str::is('*_PASSWORD', $key)
|
||||||
|
|| Str::is('*_SECRET', $key) || Str::is('*_PW', $key)
|
||||||
|
) {
|
||||||
$data['request_server'][$key] = '******';
|
$data['request_server'][$key] = '******';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,7 +131,7 @@ class RequestCollector extends DataCollector implements DataCollectorInterface,
|
||||||
if (isset($data['request_server']['PHP_AUTH_PW'])) {
|
if (isset($data['request_server']['PHP_AUTH_PW'])) {
|
||||||
$data['request_server']['PHP_AUTH_PW'] = '******';
|
$data['request_server']['PHP_AUTH_PW'] = '******';
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
foreach ($data as $key => $var) {
|
foreach ($data as $key => $var) {
|
||||||
if (!is_string($data[$key])) {
|
if (!is_string($data[$key])) {
|
||||||
|
@ -137,7 +139,6 @@ class RequestCollector extends DataCollector implements DataCollectorInterface,
|
||||||
} else {
|
} else {
|
||||||
$data[$key] = e($data[$key]);
|
$data[$key] = e($data[$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$htmlData = [];
|
$htmlData = [];
|
||||||
|
@ -147,7 +148,7 @@ class RequestCollector extends DataCollector implements DataCollectorInterface,
|
||||||
])->type('debugbar');
|
])->type('debugbar');
|
||||||
Telescope::$entriesQueue[] = $entry;
|
Telescope::$entriesQueue[] = $entry;
|
||||||
$url = route('debugbar.telescope', [$entry->uuid]);
|
$url = route('debugbar.telescope', [$entry->uuid]);
|
||||||
$htmlData['telescope'] = '<a href="'.$url.'" target="_blank">View in Telescope</a>';
|
$htmlData['telescope'] = '<a href="' . $url . '" target="_blank">View in Telescope</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $htmlData + $data;
|
return $htmlData + $data;
|
||||||
|
@ -172,10 +173,10 @@ class RequestCollector extends DataCollector implements DataCollectorInterface,
|
||||||
}
|
}
|
||||||
|
|
||||||
$cookie .= '; expires=' . substr(
|
$cookie .= '; expires=' . substr(
|
||||||
\DateTime::createFromFormat('U', $expires, new \DateTimeZone('UTC'))->format('D, d-M-Y H:i:s T'),
|
\DateTime::createFromFormat('U', $expires, new \DateTimeZone('UTC'))->format('D, d-M-Y H:i:s T'),
|
||||||
0,
|
0,
|
||||||
-5
|
-5
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($domain) {
|
if ($domain) {
|
||||||
|
|
|
@ -49,22 +49,26 @@ class RouteCollector extends DataCollector implements Renderable
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
$uri = head($route->methods()) . ' ' . $route->uri();
|
$uri = head($route->methods()) . ' ' . $route->uri();
|
||||||
$action = $route->getAction();
|
$action = $route->getAction();
|
||||||
|
|
||||||
$result = [
|
$result = [
|
||||||
'uri' => $uri ?: '-',
|
'uri' => $uri ?: '-',
|
||||||
];
|
];
|
||||||
|
|
||||||
$result = array_merge($result, $action);
|
$result = array_merge($result, $action);
|
||||||
|
|
||||||
|
|
||||||
if (isset($action['controller']) && is_string($action['controller']) && strpos($action['controller'], '@') !== false) {
|
if (
|
||||||
list($controller, $method) = explode('@', $action['controller']);
|
isset($action['controller'])
|
||||||
if(class_exists($controller) && method_exists($controller, $method)) {
|
&& is_string($action['controller'])
|
||||||
$reflector = new \ReflectionMethod($controller, $method);
|
&& strpos($action['controller'], '@') !== false
|
||||||
}
|
) {
|
||||||
|
list($controller, $method) = explode('@', $action['controller']);
|
||||||
|
if (class_exists($controller) && method_exists($controller, $method)) {
|
||||||
|
$reflector = new \ReflectionMethod($controller, $method);
|
||||||
|
}
|
||||||
unset($result['uses']);
|
unset($result['uses']);
|
||||||
} elseif (isset($action['uses']) && $action['uses'] instanceof \Closure) {
|
} elseif (isset($action['uses']) && $action['uses'] instanceof \Closure) {
|
||||||
$reflector = new \ReflectionFunction($action['uses']);
|
$reflector = new \ReflectionFunction($action['uses']);
|
||||||
$result['uses'] = $this->formatVar($result['uses']);
|
$result['uses'] = $this->formatVar($result['uses']);
|
||||||
}
|
}
|
||||||
|
@ -74,9 +78,9 @@ class RouteCollector extends DataCollector implements Renderable
|
||||||
$result['file'] = $filename . ':' . $reflector->getStartLine() . '-' . $reflector->getEndLine();
|
$result['file'] = $filename . ':' . $reflector->getStartLine() . '-' . $reflector->getEndLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($middleware = $this->getMiddleware($route)) {
|
if ($middleware = $this->getMiddleware($route)) {
|
||||||
$result['middleware'] = $middleware;
|
$result['middleware'] = $middleware;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ class ViewCollector extends TwigCollector
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ( $this->getXdebugLink($path)) {
|
if ($this->getXdebugLink($path)) {
|
||||||
$template['xdebug_link'] = $this->getXdebugLink($path);
|
$template['xdebug_link'] = $this->getXdebugLink($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,10 @@ class QueryFormatter extends DataFormatter
|
||||||
*/
|
*/
|
||||||
public function formatSql($sql)
|
public function formatSql($sql)
|
||||||
{
|
{
|
||||||
$sql = preg_replace("/\?(?=(?:[^'\\\']*'[^'\\']*')*[^'\\\']*$)(?:\?)/", '?', $sql);
|
$sql = preg_replace("/\?(?=(?:[^'\\\']*'[^'\\']*')*[^'\\\']*$)(?:\?)/", '?', $sql);
|
||||||
$sql = trim(preg_replace("/\s*\n\s*/", "\n", $sql));
|
$sql = trim(preg_replace("/\s*\n\s*/", "\n", $sql));
|
||||||
|
|
||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -60,7 +60,8 @@ class SimpleFormatter extends DataFormatter
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($deep) {
|
if ($deep) {
|
||||||
return sprintf("[\n%s%s\n%s]", $indent, implode(sprintf(", \n%s", $indent), $a), str_repeat(' ', $depth - 1));
|
$args = [$indent, implode(sprintf(", \n%s", $indent), $a), str_repeat(' ', $depth - 1)];
|
||||||
|
return sprintf("[\n%s%s\n%s]", $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
$s = sprintf('[%s]', implode(', ', $a));
|
$s = sprintf('[%s]', implode(', ', $a));
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
<?php namespace Barryvdh\Debugbar;
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar;
|
||||||
|
|
||||||
|
use DebugBar\DataCollector\DataCollectorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method static \Barryvdh\Debugbar\LaravelDebugbar addCollector(\DebugBar\DataCollector\DataCollectorInterface $collector)
|
* @method static LaravelDebugbar addCollector(DataCollectorInterface $collector)
|
||||||
* @method static void addMessage(mixed $message, string $label = 'info')
|
* @method static void addMessage(mixed $message, string $label = 'info')
|
||||||
* @method static void alert(mixed $message)
|
* @method static void alert(mixed $message)
|
||||||
* @method static void critical(mixed $message)
|
* @method static void critical(mixed $message)
|
||||||
* @method static void debug(mixed $message)
|
* @method static void debug(mixed $message)
|
||||||
* @method static void emergency(mixed $message)
|
* @method static void emergency(mixed $message)
|
||||||
* @method static void error(mixed $message)
|
* @method static void error(mixed $message)
|
||||||
* @method static \Barryvdh\Debugbar\LaravelDebugbar getCollector(string $name)
|
* @method static LaravelDebugbar getCollector(string $name)
|
||||||
* @method static bool hasCollector(string $name)
|
* @method static bool hasCollector(string $name)
|
||||||
* @method static void info(mixed $message)
|
* @method static void info(mixed $message)
|
||||||
* @method static void log(mixed $message)
|
* @method static void log(mixed $message)
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?php namespace Barryvdh\Debugbar;
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar;
|
||||||
|
|
||||||
use DebugBar\DebugBar;
|
use DebugBar\DebugBar;
|
||||||
use DebugBar\JavascriptRenderer as BaseJavascriptRenderer;
|
use DebugBar\JavascriptRenderer as BaseJavascriptRenderer;
|
||||||
|
@ -42,7 +44,6 @@ class JavascriptRenderer extends BaseJavascriptRenderer
|
||||||
*/
|
*/
|
||||||
public function setUrlGenerator($url)
|
public function setUrlGenerator($url)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?php namespace Barryvdh\Debugbar;
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar;
|
||||||
|
|
||||||
use Barryvdh\Debugbar\DataCollector\AuthCollector;
|
use Barryvdh\Debugbar\DataCollector\AuthCollector;
|
||||||
use Barryvdh\Debugbar\DataCollector\CacheCollector;
|
use Barryvdh\Debugbar\DataCollector\CacheCollector;
|
||||||
|
@ -31,7 +33,6 @@ use DebugBar\DebugBar;
|
||||||
use DebugBar\Storage\PdoStorage;
|
use DebugBar\Storage\PdoStorage;
|
||||||
use DebugBar\Storage\RedisStorage;
|
use DebugBar\Storage\RedisStorage;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
use Illuminate\Contracts\Foundation\Application;
|
use Illuminate\Contracts\Foundation\Application;
|
||||||
use Illuminate\Session\SessionManager;
|
use Illuminate\Session\SessionManager;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
@ -130,7 +131,7 @@ class LaravelDebugbar extends DebugBar
|
||||||
$app = $this->app;
|
$app = $this->app;
|
||||||
|
|
||||||
// Set custom error handler
|
// Set custom error handler
|
||||||
if ($app['config']->get('debugbar.error_handler' , false)) {
|
if ($app['config']->get('debugbar.error_handler', false)) {
|
||||||
set_error_handler([$this, 'handleError']);
|
set_error_handler([$this, 'handleError']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +148,7 @@ class LaravelDebugbar extends DebugBar
|
||||||
if ($this->shouldCollect('time', true)) {
|
if ($this->shouldCollect('time', true)) {
|
||||||
$this->addCollector(new TimeDataCollector());
|
$this->addCollector(new TimeDataCollector());
|
||||||
|
|
||||||
if ( ! $this->isLumen()) {
|
if (! $this->isLumen()) {
|
||||||
$this->app->booted(
|
$this->app->booted(
|
||||||
function () use ($debugbar) {
|
function () use ($debugbar) {
|
||||||
$startTime = $this->app['request']->server('REQUEST_TIME_FLOAT');
|
$startTime = $this->app['request']->server('REQUEST_TIME_FLOAT');
|
||||||
|
@ -190,7 +191,6 @@ class LaravelDebugbar extends DebugBar
|
||||||
$eventCollector = new EventCollector($startTime);
|
$eventCollector = new EventCollector($startTime);
|
||||||
$this->addCollector($eventCollector);
|
$this->addCollector($eventCollector);
|
||||||
$this->app['events']->subscribe($eventCollector);
|
$this->app['events']->subscribe($eventCollector);
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->addThrowable(
|
$this->addThrowable(
|
||||||
new Exception(
|
new Exception(
|
||||||
|
@ -218,7 +218,9 @@ class LaravelDebugbar extends DebugBar
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->addThrowable(
|
$this->addThrowable(
|
||||||
new Exception(
|
new Exception(
|
||||||
'Cannot add ViewCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e
|
'Cannot add ViewCollector to Laravel Debugbar: ' . $e->getMessage(),
|
||||||
|
$e->getCode(),
|
||||||
|
$e
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -277,7 +279,9 @@ class LaravelDebugbar extends DebugBar
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->addThrowable(
|
$this->addThrowable(
|
||||||
new Exception(
|
new Exception(
|
||||||
'Cannot add LogsCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e
|
'Cannot add LogsCollector to Laravel Debugbar: ' . $e->getMessage(),
|
||||||
|
$e->getCode(),
|
||||||
|
$e
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -285,7 +289,8 @@ class LaravelDebugbar extends DebugBar
|
||||||
|
|
||||||
if ($this->shouldCollect('db', true) && isset($this->app['db'])) {
|
if ($this->shouldCollect('db', true) && isset($this->app['db'])) {
|
||||||
$db = $this->app['db'];
|
$db = $this->app['db'];
|
||||||
if ($debugbar->hasCollector('time') && $this->app['config']->get(
|
if (
|
||||||
|
$debugbar->hasCollector('time') && $this->app['config']->get(
|
||||||
'debugbar.options.db.timeline',
|
'debugbar.options.db.timeline',
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
@ -329,14 +334,22 @@ class LaravelDebugbar extends DebugBar
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$db->listen(
|
$db->listen(
|
||||||
function ($query, $bindings = null, $time = null, $connectionName = null) use ($db, $queryCollector) {
|
function (
|
||||||
|
$query,
|
||||||
|
$bindings = null,
|
||||||
|
$time = null,
|
||||||
|
$connectionName = null
|
||||||
|
) use (
|
||||||
|
$db,
|
||||||
|
$queryCollector
|
||||||
|
) {
|
||||||
if (!$this->shouldCollect('db', true)) {
|
if (!$this->shouldCollect('db', true)) {
|
||||||
return; // Issue 776 : We've turned off collecting after the listener was attached
|
return; // Issue 776 : We've turned off collecting after the listener was attached
|
||||||
}
|
}
|
||||||
// Laravel 5.2 changed the way some core events worked. We must account for
|
// Laravel 5.2 changed the way some core events worked. We must account for
|
||||||
// the first argument being an "event object", where arguments are passed
|
// the first argument being an "event object", where arguments are passed
|
||||||
// via object properties, instead of individual arguments.
|
// via object properties, instead of individual arguments.
|
||||||
if ( $query instanceof \Illuminate\Database\Events\QueryExecuted ) {
|
if ($query instanceof \Illuminate\Database\Events\QueryExecuted) {
|
||||||
$bindings = $query->bindings;
|
$bindings = $query->bindings;
|
||||||
$time = $query->time;
|
$time = $query->time;
|
||||||
$connection = $query->connection;
|
$connection = $query->connection;
|
||||||
|
@ -420,7 +433,7 @@ class LaravelDebugbar extends DebugBar
|
||||||
try {
|
try {
|
||||||
$modelsCollector = $this->app->make('Barryvdh\Debugbar\DataCollector\ModelsCollector');
|
$modelsCollector = $this->app->make('Barryvdh\Debugbar\DataCollector\ModelsCollector');
|
||||||
$this->addCollector($modelsCollector);
|
$this->addCollector($modelsCollector);
|
||||||
} catch (\Exception $e){
|
} catch (\Exception $e) {
|
||||||
// No Models collector
|
// No Models collector
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -429,7 +442,7 @@ class LaravelDebugbar extends DebugBar
|
||||||
try {
|
try {
|
||||||
$livewireCollector = $this->app->make('Barryvdh\Debugbar\DataCollector\LivewireCollector');
|
$livewireCollector = $this->app->make('Barryvdh\Debugbar\DataCollector\LivewireCollector');
|
||||||
$this->addCollector($livewireCollector);
|
$this->addCollector($livewireCollector);
|
||||||
} catch (\Exception $e){
|
} catch (\Exception $e) {
|
||||||
$this->addThrowable(
|
$this->addThrowable(
|
||||||
new Exception('Cannot add Livewire Collector: ' . $e->getMessage(), $e->getCode(), $e)
|
new Exception('Cannot add Livewire Collector: ' . $e->getMessage(), $e->getCode(), $e)
|
||||||
);
|
);
|
||||||
|
@ -440,7 +453,8 @@ class LaravelDebugbar extends DebugBar
|
||||||
try {
|
try {
|
||||||
$mailer = $this->app['mailer']->getSwiftMailer();
|
$mailer = $this->app['mailer']->getSwiftMailer();
|
||||||
$this->addCollector(new SwiftMailCollector($mailer));
|
$this->addCollector(new SwiftMailCollector($mailer));
|
||||||
if ($this->app['config']->get('debugbar.options.mail.full_log') && $this->hasCollector(
|
if (
|
||||||
|
$this->app['config']->get('debugbar.options.mail.full_log') && $this->hasCollector(
|
||||||
'messages'
|
'messages'
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
@ -449,7 +463,9 @@ class LaravelDebugbar extends DebugBar
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->addThrowable(
|
$this->addThrowable(
|
||||||
new Exception(
|
new Exception(
|
||||||
'Cannot add MailCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e
|
'Cannot add MailCollector to Laravel Debugbar: ' . $e->getMessage(),
|
||||||
|
$e->getCode(),
|
||||||
|
$e
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -462,7 +478,9 @@ class LaravelDebugbar extends DebugBar
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->addThrowable(
|
$this->addThrowable(
|
||||||
new Exception(
|
new Exception(
|
||||||
'Cannot add LogsCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e
|
'Cannot add LogsCollector to Laravel Debugbar: ' . $e->getMessage(),
|
||||||
|
$e->getCode(),
|
||||||
|
$e
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -471,29 +489,31 @@ class LaravelDebugbar extends DebugBar
|
||||||
$this->addCollector(new FilesCollector($app));
|
$this->addCollector(new FilesCollector($app));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->shouldCollect('auth', false)) {
|
if ($this->shouldCollect('auth', false)) {
|
||||||
try {
|
try {
|
||||||
$guards = $this->app['config']->get('auth.guards', []);
|
$guards = $this->app['config']->get('auth.guards', []);
|
||||||
$authCollector = new MultiAuthCollector($app['auth'], $guards);
|
$authCollector = new MultiAuthCollector($app['auth'], $guards);
|
||||||
|
|
||||||
$authCollector->setShowName(
|
$authCollector->setShowName(
|
||||||
$this->app['config']->get('debugbar.options.auth.show_name')
|
$this->app['config']->get('debugbar.options.auth.show_name')
|
||||||
);
|
);
|
||||||
$this->addCollector($authCollector);
|
$this->addCollector($authCollector);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->addThrowable(
|
$this->addThrowable(
|
||||||
new Exception(
|
new Exception(
|
||||||
'Cannot add AuthCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e
|
'Cannot add AuthCollector to Laravel Debugbar: ' . $e->getMessage(),
|
||||||
)
|
$e->getCode(),
|
||||||
);
|
$e
|
||||||
}
|
)
|
||||||
}
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->shouldCollect('gate', false)) {
|
if ($this->shouldCollect('gate', false)) {
|
||||||
try {
|
try {
|
||||||
$gateCollector = $this->app->make('Barryvdh\Debugbar\DataCollector\GateCollector');
|
$gateCollector = $this->app->make('Barryvdh\Debugbar\DataCollector\GateCollector');
|
||||||
$this->addCollector($gateCollector);
|
$this->addCollector($gateCollector);
|
||||||
} catch (\Exception $e){
|
} catch (\Exception $e) {
|
||||||
// No Gate collector
|
// No Gate collector
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -505,7 +525,6 @@ class LaravelDebugbar extends DebugBar
|
||||||
$cacheCollector = new CacheCollector($startTime, $collectValues);
|
$cacheCollector = new CacheCollector($startTime, $collectValues);
|
||||||
$this->addCollector($cacheCollector);
|
$this->addCollector($cacheCollector);
|
||||||
$this->app['events']->subscribe($cacheCollector);
|
$this->app['events']->subscribe($cacheCollector);
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->addThrowable(
|
$this->addThrowable(
|
||||||
new Exception(
|
new Exception(
|
||||||
|
@ -676,7 +695,7 @@ class LaravelDebugbar extends DebugBar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->app->bound(SessionManager::class)){
|
if ($this->app->bound(SessionManager::class)) {
|
||||||
|
|
||||||
/** @var \Illuminate\Session\SessionManager $sessionManager */
|
/** @var \Illuminate\Session\SessionManager $sessionManager */
|
||||||
$sessionManager = $app->make(SessionManager::class);
|
$sessionManager = $app->make(SessionManager::class);
|
||||||
|
@ -702,7 +721,8 @@ class LaravelDebugbar extends DebugBar
|
||||||
|
|
||||||
if ($this->shouldCollect('symfony_request', true) && !$this->hasCollector('request')) {
|
if ($this->shouldCollect('symfony_request', true) && !$this->hasCollector('request')) {
|
||||||
try {
|
try {
|
||||||
$this->addCollector(new RequestCollector($request, $response, $sessionManager, $this->getCurrentRequestId()));
|
$reqId = $this->getCurrentRequestId();
|
||||||
|
$this->addCollector(new RequestCollector($request, $response, $sessionManager, $reqId));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->addThrowable(
|
$this->addThrowable(
|
||||||
new Exception(
|
new Exception(
|
||||||
|
@ -715,7 +735,6 @@ class LaravelDebugbar extends DebugBar
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($app['config']->get('debugbar.clockwork') && ! $this->hasCollector('clockwork')) {
|
if ($app['config']->get('debugbar.clockwork') && ! $this->hasCollector('clockwork')) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->addCollector(new ClockworkCollector($request, $response, $sessionManager));
|
$this->addCollector(new ClockworkCollector($request, $response, $sessionManager));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
@ -747,16 +766,15 @@ class LaravelDebugbar extends DebugBar
|
||||||
if ($app['config']->get('debugbar.add_ajax_timing', false)) {
|
if ($app['config']->get('debugbar.add_ajax_timing', false)) {
|
||||||
$this->addServerTimingHeaders($response);
|
$this->addServerTimingHeaders($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$app['log']->error('Debugbar exception: ' . $e->getMessage());
|
$app['log']->error('Debugbar exception: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
} elseif (
|
} elseif (
|
||||||
($response->headers->has('Content-Type') &&
|
($response->headers->has('Content-Type') &&
|
||||||
strpos($response->headers->get('Content-Type'), 'html') === false)
|
strpos($response->headers->get('Content-Type'), 'html') === false) ||
|
||||||
|| $request->getRequestFormat() !== 'html'
|
$request->getRequestFormat() !== 'html' ||
|
||||||
|| $response->getContent() === false
|
$response->getContent() === false ||
|
||||||
|| $this->isJsonRequest($request)
|
$this->isJsonRequest($request)
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
// Just collect + store data, don't inject it.
|
// Just collect + store data, don't inject it.
|
||||||
|
@ -1013,7 +1031,7 @@ class LaravelDebugbar extends DebugBar
|
||||||
{
|
{
|
||||||
$messageLevels = ['emergency', 'alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug', 'log'];
|
$messageLevels = ['emergency', 'alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug', 'log'];
|
||||||
if (in_array($method, $messageLevels)) {
|
if (in_array($method, $messageLevels)) {
|
||||||
foreach($args as $arg) {
|
foreach ($args as $arg) {
|
||||||
$this->addMessage($arg, $method);
|
$this->addMessage($arg, $method);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1097,7 +1115,7 @@ class LaravelDebugbar extends DebugBar
|
||||||
$prefix = $this->app['config']->get('debugbar.route_prefix');
|
$prefix = $this->app['config']->get('debugbar.route_prefix');
|
||||||
$response->headers->set('X-Clockwork-Id', $this->getCurrentRequestId(), true);
|
$response->headers->set('X-Clockwork-Id', $this->getCurrentRequestId(), true);
|
||||||
$response->headers->set('X-Clockwork-Version', 1, true);
|
$response->headers->set('X-Clockwork-Version', 1, true);
|
||||||
$response->headers->set('X-Clockwork-Path', $prefix .'/clockwork/', true);
|
$response->headers->set('X-Clockwork-Path', $prefix . '/clockwork/', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?php namespace Barryvdh\Debugbar;
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar;
|
||||||
|
|
||||||
use Laravel\Lumen\Application;
|
use Laravel\Lumen\Application;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?php namespace Barryvdh\Debugbar\Middleware;
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar\Middleware;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
@ -37,6 +39,5 @@ class DebugbarEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?php namespace Barryvdh\Debugbar\Middleware;
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar\Middleware;
|
||||||
|
|
||||||
use Error;
|
use Error;
|
||||||
use Closure;
|
use Closure;
|
||||||
|
@ -74,7 +76,6 @@ class InjectDebugbar
|
||||||
$this->debugbar->modifyResponse($request, $response);
|
$this->debugbar->modifyResponse($request, $response);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function($) {
|
(function ($) {
|
||||||
|
|
||||||
var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-');
|
var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-');
|
||||||
|
|
||||||
|
@ -14,39 +14,39 @@
|
||||||
|
|
||||||
className: csscls('timeline cache'),
|
className: csscls('timeline cache'),
|
||||||
|
|
||||||
onForgetClick: function(e, el) {
|
onForgetClick: function (e, el) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: $(el).attr("data-url"),
|
url: $(el).attr("data-url"),
|
||||||
type: 'DELETE',
|
type: 'DELETE',
|
||||||
success: function(result) {
|
success: function (result) {
|
||||||
$(el).fadeOut(200);
|
$(el).fadeOut(200);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function () {
|
||||||
LaravelCacheWidget.__super__.render.apply(this);
|
LaravelCacheWidget.__super__.render.apply(this);
|
||||||
|
|
||||||
this.bindAttr('data', function(data) {
|
this.bindAttr('data', function (data) {
|
||||||
|
|
||||||
if (data.measures) {
|
if (data.measures) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var lines = this.$el.find('.'+csscls('measure'));
|
var lines = this.$el.find('.' + csscls('measure'));
|
||||||
|
|
||||||
for (var i = 0; i < data.measures.length; i++) {
|
for (var i = 0; i < data.measures.length; i++) {
|
||||||
var measure = data.measures[i];
|
var measure = data.measures[i];
|
||||||
var m = lines[i];
|
var m = lines[i];
|
||||||
|
|
||||||
if (measure.params && !$.isEmptyObject(measure.params)) {
|
if (measure.params && !$.isEmptyObject(measure.params)) {
|
||||||
|
|
||||||
if (measure.params.delete && measure.params.key) {
|
if (measure.params.delete && measure.params.key) {
|
||||||
$('<a />')
|
$('<a />')
|
||||||
.addClass(csscls('forget'))
|
.addClass(csscls('forget'))
|
||||||
.text('forget')
|
.text('forget')
|
||||||
.attr('data-url', measure.params.delete)
|
.attr('data-url', measure.params.delete)
|
||||||
.one('click', function(e) { self.onForgetClick(e, this); })
|
.one('click', function (e) {
|
||||||
|
self.onForgetClick(e, this); })
|
||||||
.appendTo(m);
|
.appendTo(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function($) {
|
(function ($) {
|
||||||
|
|
||||||
var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-');
|
var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-');
|
||||||
|
|
||||||
|
@ -12,11 +12,11 @@
|
||||||
|
|
||||||
className: csscls('sqlqueries'),
|
className: csscls('sqlqueries'),
|
||||||
|
|
||||||
onFilterClick: function(el) {
|
onFilterClick: function (el) {
|
||||||
$(el).toggleClass(csscls('excluded'));
|
$(el).toggleClass(csscls('excluded'));
|
||||||
|
|
||||||
var excludedLabels = [];
|
var excludedLabels = [];
|
||||||
this.$toolbar.find(csscls('.filter') + csscls('.excluded')).each(function() {
|
this.$toolbar.find(csscls('.filter') + csscls('.excluded')).each(function () {
|
||||||
excludedLabels.push(this.rel);
|
excludedLabels.push(this.rel);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -52,14 +52,14 @@
|
||||||
select(code);
|
select(code);
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function () {
|
||||||
this.$status = $('<div />').addClass(csscls('status')).appendTo(this.$el);
|
this.$status = $('<div />').addClass(csscls('status')).appendTo(this.$el);
|
||||||
|
|
||||||
this.$toolbar = $('<div></div>').addClass(csscls('toolbar')).appendTo(this.$el);
|
this.$toolbar = $('<div></div>').addClass(csscls('toolbar')).appendTo(this.$el);
|
||||||
|
|
||||||
var filters = [], self = this;
|
var filters = [], self = this;
|
||||||
|
|
||||||
this.$list = new PhpDebugBar.Widgets.ListWidget({ itemRenderer: function(li, stmt) {
|
this.$list = new PhpDebugBar.Widgets.ListWidget({ itemRenderer: function (li, stmt) {
|
||||||
if (stmt.type === 'transaction') {
|
if (stmt.type === 'transaction') {
|
||||||
$('<strong />').addClass(csscls('sql')).addClass(csscls('name')).text(stmt.sql).appendTo(li);
|
$('<strong />').addClass(csscls('sql')).addClass(csscls('name')).text(stmt.sql).appendTo(li);
|
||||||
} else {
|
} else {
|
||||||
|
@ -86,9 +86,10 @@
|
||||||
.addClass(csscls('filter'))
|
.addClass(csscls('filter'))
|
||||||
.text(stmt.connection)
|
.text(stmt.connection)
|
||||||
.attr('rel', stmt.connection)
|
.attr('rel', stmt.connection)
|
||||||
.on('click', function() { self.onFilterClick(this); })
|
.on('click', function () {
|
||||||
|
self.onFilterClick(this); })
|
||||||
.appendTo(self.$toolbar);
|
.appendTo(self.$toolbar);
|
||||||
if (filters.length>1) {
|
if (filters.length > 1) {
|
||||||
self.$toolbar.show();
|
self.$toolbar.show();
|
||||||
self.$list.$el.css("margin-bottom","20px");
|
self.$list.$el.css("margin-bottom","20px");
|
||||||
}
|
}
|
||||||
|
@ -120,7 +121,7 @@
|
||||||
var $span = $('<span />').addClass('phpdebugbar-text-muted');
|
var $span = $('<span />').addClass('phpdebugbar-text-muted');
|
||||||
|
|
||||||
var index = 0;
|
var index = 0;
|
||||||
var $bindings = new PhpDebugBar.Widgets.ListWidget({ itemRenderer: function(li, binding) {
|
var $bindings = new PhpDebugBar.Widgets.ListWidget({ itemRenderer: function (li, binding) {
|
||||||
var $index = $span.clone().text(index++ + '.');
|
var $index = $span.clone().text(index++ + '.');
|
||||||
li.append($index, ' ', binding).removeClass(csscls('list-item')).addClass(csscls('table-list-item'));
|
li.append($index, ' ', binding).removeClass(csscls('list-item')).addClass(csscls('table-list-item'));
|
||||||
}});
|
}});
|
||||||
|
@ -143,7 +144,7 @@
|
||||||
var $name = $('<td />').addClass(csscls('name')).html('Hints ' + $icon);
|
var $name = $('<td />').addClass(csscls('name')).html('Hints ' + $icon);
|
||||||
var $value = $('<td />').addClass(csscls('value'));
|
var $value = $('<td />').addClass(csscls('value'));
|
||||||
|
|
||||||
var $hints = new PhpDebugBar.Widgets.ListWidget({ itemRenderer: function(li, hint) {
|
var $hints = new PhpDebugBar.Widgets.ListWidget({ itemRenderer: function (li, hint) {
|
||||||
li.append(hint).removeClass(csscls('list-item')).addClass(csscls('table-list-item'));
|
li.append(hint).removeClass(csscls('list-item')).addClass(csscls('table-list-item'));
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
@ -165,7 +166,7 @@
|
||||||
var $value = $('<td />').addClass(csscls('value'));
|
var $value = $('<td />').addClass(csscls('value'));
|
||||||
var $span = $('<span />').addClass('phpdebugbar-text-muted');
|
var $span = $('<span />').addClass('phpdebugbar-text-muted');
|
||||||
|
|
||||||
var $backtrace = new PhpDebugBar.Widgets.ListWidget({ itemRenderer: function(li, source) {
|
var $backtrace = new PhpDebugBar.Widgets.ListWidget({ itemRenderer: function (li, source) {
|
||||||
var $parts = [
|
var $parts = [
|
||||||
$span.clone().text(source.index + '.'),
|
$span.clone().text(source.index + '.'),
|
||||||
' ',
|
' ',
|
||||||
|
@ -201,7 +202,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
li.css('cursor', 'pointer').click(function() {
|
li.css('cursor', 'pointer').click(function () {
|
||||||
if (table.is(':visible')) {
|
if (table.is(':visible')) {
|
||||||
table.hide();
|
table.hide();
|
||||||
} else {
|
} else {
|
||||||
|
@ -211,14 +212,14 @@
|
||||||
}});
|
}});
|
||||||
this.$list.$el.appendTo(this.$el);
|
this.$list.$el.appendTo(this.$el);
|
||||||
|
|
||||||
this.bindAttr('data', function(data) {
|
this.bindAttr('data', function (data) {
|
||||||
this.$list.set('data', data.statements);
|
this.$list.set('data', data.statements);
|
||||||
this.$status.empty();
|
this.$status.empty();
|
||||||
var stmt;
|
var stmt;
|
||||||
|
|
||||||
// Search for duplicate statements.
|
// Search for duplicate statements.
|
||||||
for (var sql = {}, duplicate = 0, i = 0; i < data.statements.length; i++) {
|
for (var sql = {}, duplicate = 0, i = 0; i < data.statements.length; i++) {
|
||||||
if(data.statements[i].type === 'query') {
|
if (data.statements[i].type === 'query') {
|
||||||
stmt = data.statements[i].sql;
|
stmt = data.statements[i].sql;
|
||||||
if (data.statements[i].bindings && data.statements[i].bindings.length) {
|
if (data.statements[i].bindings && data.statements[i].bindings.length) {
|
||||||
stmt += JSON.stringify(data.statements[i].bindings);
|
stmt += JSON.stringify(data.statements[i].bindings);
|
||||||
|
@ -238,7 +239,7 @@
|
||||||
for (i = 0; i < sql[stmt].keys.length; i++) {
|
for (i = 0; i < sql[stmt].keys.length; i++) {
|
||||||
this.$list.$el.find('.' + csscls('list-item')).eq(sql[stmt].keys[i])
|
this.$list.$el.find('.' + csscls('list-item')).eq(sql[stmt].keys[i])
|
||||||
.addClass(csscls('sql-duplicate'))
|
.addClass(csscls('sql-duplicate'))
|
||||||
.addClass(csscls('sql-duplicate-'+duplicate));
|
.addClass(csscls('sql-duplicate-' + duplicate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?php namespace Barryvdh\Debugbar;
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar;
|
||||||
|
|
||||||
use Barryvdh\Debugbar\Middleware\DebugbarEnabled;
|
use Barryvdh\Debugbar\Middleware\DebugbarEnabled;
|
||||||
use Barryvdh\Debugbar\Middleware\InjectDebugbar;
|
use Barryvdh\Debugbar\Middleware\InjectDebugbar;
|
||||||
|
@ -27,7 +29,7 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider
|
||||||
$configPath = __DIR__ . '/../config/debugbar.php';
|
$configPath = __DIR__ . '/../config/debugbar.php';
|
||||||
$this->mergeConfigFrom($configPath, 'debugbar');
|
$this->mergeConfigFrom($configPath, 'debugbar');
|
||||||
|
|
||||||
$this->loadRoutesFrom(realpath(__DIR__.'/debugbar-routes.php'));
|
$this->loadRoutesFrom(realpath(__DIR__ . '/debugbar-routes.php'));
|
||||||
|
|
||||||
$this->app->alias(
|
$this->app->alias(
|
||||||
DataFormatter::class,
|
DataFormatter::class,
|
||||||
|
@ -37,19 +39,19 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider
|
||||||
$this->app->singleton(LaravelDebugbar::class, function () {
|
$this->app->singleton(LaravelDebugbar::class, function () {
|
||||||
$debugbar = new LaravelDebugbar($this->app);
|
$debugbar = new LaravelDebugbar($this->app);
|
||||||
|
|
||||||
if ($this->app->bound(SessionManager::class)) {
|
if ($this->app->bound(SessionManager::class)) {
|
||||||
$sessionManager = $this->app->make(SessionManager::class);
|
$sessionManager = $this->app->make(SessionManager::class);
|
||||||
$httpDriver = new SymfonyHttpDriver($sessionManager);
|
$httpDriver = new SymfonyHttpDriver($sessionManager);
|
||||||
$debugbar->setHttpDriver($httpDriver);
|
$debugbar->setHttpDriver($httpDriver);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $debugbar;
|
return $debugbar;
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
$this->app->alias(LaravelDebugbar::class, 'debugbar');
|
$this->app->alias(LaravelDebugbar::class, 'debugbar');
|
||||||
|
|
||||||
$this->app->singleton('command.debugbar.clear',
|
$this->app->singleton(
|
||||||
|
'command.debugbar.clear',
|
||||||
function ($app) {
|
function ($app) {
|
||||||
return new Console\ClearCommand($app['debugbar']);
|
return new Console\ClearCommand($app['debugbar']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,9 +67,11 @@ class FilesystemStorage implements StorageInterface
|
||||||
*/
|
*/
|
||||||
protected function garbageCollect()
|
protected function garbageCollect()
|
||||||
{
|
{
|
||||||
foreach (Finder::create()->files()->name('*.json')->date('< ' . $this->gc_lifetime . ' hour ago')->in(
|
foreach (
|
||||||
$this->dirname
|
Finder::create()->files()->name('*.json')->date('< ' . $this->gc_lifetime . ' hour ago')->in(
|
||||||
) as $file) {
|
$this->dirname
|
||||||
|
) as $file
|
||||||
|
) {
|
||||||
$this->files->delete($file->getRealPath());
|
$this->files->delete($file->getRealPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,5 +87,4 @@ class ClockworkCollector extends DataCollector implements DataCollectorInterface
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
<?php namespace Barryvdh\Debugbar\Support\Clockwork;
|
<?php
|
||||||
|
|
||||||
class Converter {
|
namespace Barryvdh\Debugbar\Support\Clockwork;
|
||||||
|
|
||||||
|
class Converter
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the phpdebugbar data to Clockwork format.
|
* Convert the phpdebugbar data to Clockwork format.
|
||||||
|
@ -42,7 +45,7 @@ class Converter {
|
||||||
$output['time'] = $time['start'];
|
$output['time'] = $time['start'];
|
||||||
$output['responseTime'] = $time['end'];
|
$output['responseTime'] = $time['end'];
|
||||||
$output['responseDuration'] = $time['duration'] * 1000;
|
$output['responseDuration'] = $time['duration'] * 1000;
|
||||||
foreach($time['measures'] as $measure) {
|
foreach ($time['measures'] as $measure) {
|
||||||
$output['timelineData'][] = [
|
$output['timelineData'][] = [
|
||||||
'data' => [],
|
'data' => [],
|
||||||
'description' => $measure['label'],
|
'description' => $measure['label'],
|
||||||
|
@ -79,7 +82,7 @@ class Converter {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data['messages'])) {
|
if (isset($data['messages'])) {
|
||||||
foreach($data['messages']['messages'] as $message) {
|
foreach ($data['messages']['messages'] as $message) {
|
||||||
$output['log'][] = [
|
$output['log'][] = [
|
||||||
'message' => $message['message'],
|
'message' => $message['message'],
|
||||||
'time' => $message['time'],
|
'time' => $message['time'],
|
||||||
|
@ -90,7 +93,7 @@ class Converter {
|
||||||
|
|
||||||
if (isset($data['queries'])) {
|
if (isset($data['queries'])) {
|
||||||
$queries = $data['queries'];
|
$queries = $data['queries'];
|
||||||
foreach($queries['statements'] as $statement){
|
foreach ($queries['statements'] as $statement) {
|
||||||
if ($statement['type'] === 'explain') {
|
if ($statement['type'] === 'explain') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +124,7 @@ class Converter {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data['swiftmailer_mails'])) {
|
if (isset($data['swiftmailer_mails'])) {
|
||||||
foreach($data['swiftmailer_mails']['mails'] as $mail) {
|
foreach ($data['swiftmailer_mails']['mails'] as $mail) {
|
||||||
$output['emailsData'][] = [
|
$output['emailsData'][] = [
|
||||||
'data' => [
|
'data' => [
|
||||||
'to' => $mail['to'],
|
'to' => $mail['to'],
|
||||||
|
@ -134,5 +137,4 @@ class Converter {
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?php namespace Barryvdh\Debugbar\Twig\Extension;
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar\Twig\Extension;
|
||||||
|
|
||||||
use Illuminate\Foundation\Application;
|
use Illuminate\Foundation\Application;
|
||||||
use Twig_Environment;
|
use Twig_Environment;
|
||||||
|
@ -44,7 +46,9 @@ class Debug extends Twig_Extension
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
new Twig_SimpleFunction(
|
new Twig_SimpleFunction(
|
||||||
'debug', [$this, 'debug'], ['needs_context' => true, 'needs_environment' => true]
|
'debug',
|
||||||
|
[$this, 'debug'],
|
||||||
|
['needs_context' => true, 'needs_environment' => true]
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?php namespace Barryvdh\Debugbar\Twig\Extension;
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar\Twig\Extension;
|
||||||
|
|
||||||
use DebugBar\DataFormatter\DataFormatterInterface;
|
use DebugBar\DataFormatter\DataFormatterInterface;
|
||||||
use Twig_Environment;
|
use Twig_Environment;
|
||||||
|
@ -40,7 +42,9 @@ class Dump extends Twig_Extension
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
new Twig_SimpleFunction(
|
new Twig_SimpleFunction(
|
||||||
'dump', [$this, 'dump'], ['is_safe' => ['html'], 'needs_context' => true, 'needs_environment' => true]
|
'dump',
|
||||||
|
[$this, 'dump'],
|
||||||
|
['is_safe' => ['html'], 'needs_context' => true, 'needs_environment' => true]
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -79,6 +83,6 @@ class Dump extends Twig_Extension
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return '<pre>'.$output.'</pre>';
|
return '<pre>' . $output . '</pre>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?php namespace Barryvdh\Debugbar\Twig\Extension;
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar\Twig\Extension;
|
||||||
|
|
||||||
use Barryvdh\Debugbar\Twig\TokenParser\StopwatchTokenParser;
|
use Barryvdh\Debugbar\Twig\TokenParser\StopwatchTokenParser;
|
||||||
use Illuminate\Foundation\Application;
|
use Illuminate\Foundation\Application;
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?php namespace Barryvdh\Debugbar\Twig\Node;
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar\Twig\Node;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a stopwatch node. Based on Symfony\Bridge\Twig\Node\StopwatchNode
|
* Represents a stopwatch node. Based on Symfony\Bridge\Twig\Node\StopwatchNode
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?php namespace Barryvdh\Debugbar\Twig\TokenParser;
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar\Twig\TokenParser;
|
||||||
|
|
||||||
use Barryvdh\Debugbar\Twig\Node\StopwatchNode;
|
use Barryvdh\Debugbar\Twig\Node\StopwatchNode;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ $routeConfig = [
|
||||||
'middleware' => [\Barryvdh\Debugbar\Middleware\DebugbarEnabled::class],
|
'middleware' => [\Barryvdh\Debugbar\Middleware\DebugbarEnabled::class],
|
||||||
];
|
];
|
||||||
|
|
||||||
app('router')->group($routeConfig, function($router) {
|
app('router')->group($routeConfig, function ($router) {
|
||||||
$router->get('open', [
|
$router->get('open', [
|
||||||
'uses' => 'OpenHandlerController@handle',
|
'uses' => 'OpenHandlerController@handle',
|
||||||
'as' => 'debugbar.openhandler',
|
'as' => 'debugbar.openhandler',
|
||||||
|
|
|
@ -2,8 +2,9 @@
|
||||||
|
|
||||||
namespace Barryvdh\Debugbar\Tests\DataCollector;
|
namespace Barryvdh\Debugbar\Tests\DataCollector;
|
||||||
|
|
||||||
|
use Barryvdh\Debugbar\Tests\Models\Person;
|
||||||
|
use Barryvdh\Debugbar\Tests\Models\User;
|
||||||
use Barryvdh\Debugbar\Tests\TestCase;
|
use Barryvdh\Debugbar\Tests\TestCase;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
|
@ -11,8 +12,7 @@ class ModelsCollectorTest extends TestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
|
|
||||||
/** @test */
|
public function testItCollectsRetrievedModels()
|
||||||
public function it_collects_retrieved_models()
|
|
||||||
{
|
{
|
||||||
$this->loadLaravelMigrations();
|
$this->loadLaravelMigrations();
|
||||||
|
|
||||||
|
@ -53,13 +53,3 @@ class ModelsCollectorTest extends TestCase
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class User extends Model
|
|
||||||
{
|
|
||||||
protected $table = 'users';
|
|
||||||
protected $guarded = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
class Person extends User
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
|
@ -10,8 +10,7 @@ class QueryCollectorTest extends TestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
|
|
||||||
/** @test */
|
public function testItReplacesQuestionMarksBindingsCorrectly()
|
||||||
public function it_replaces_question_marks_bindings_correctly()
|
|
||||||
{
|
{
|
||||||
$this->loadLaravelMigrations();
|
$this->loadLaravelMigrations();
|
||||||
|
|
||||||
|
@ -31,7 +30,10 @@ class QueryCollectorTest extends TestCase
|
||||||
|
|
||||||
tap(Arr::first($collection['statements']), function (array $statement) {
|
tap(Arr::first($collection['statements']), function (array $statement) {
|
||||||
$this->assertEquals([3, '{4}'], $statement['bindings']);
|
$this->assertEquals([3, '{4}'], $statement['bindings']);
|
||||||
$this->assertEquals("SELECT ('[1, 2, 3]'::jsonb ? 3) as a, ('[4, 5, 6]'::jsonb ?| '{4}') as b, 'hello world ? example ??' as c", $statement['sql']);
|
$this->assertEquals(<<<SQL
|
||||||
|
SELECT ('[1, 2, 3]'::jsonb ? 3) as a, ('[4, 5, 6]'::jsonb ?| '{4}') as b, 'hello world ? example ??' as c
|
||||||
|
SQL
|
||||||
|
, $statement['sql']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar\Tests\Models;
|
||||||
|
|
||||||
|
class Person extends User
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Barryvdh\Debugbar\Tests\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class User extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'users';
|
||||||
|
protected $guarded = [];
|
||||||
|
}
|
Loading…
Reference in New Issue