本文整理汇总了PHP中Barryvdh\Debugbar\LaravelDebugbar类的典型用法代码示例。如果您正苦于以下问题:PHP LaravelDebugbar类的具体用法?PHP LaravelDebugbar怎么用?PHP LaravelDebugbar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LaravelDebugbar类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
public function boot(LaravelDebugbar $debugBar, EventDispatcher $eventDispatcher, ViewComposerCollector $viewComposerCollector)
{
$eventDispatcher->listen("creating: *", function (View $view) use($viewComposerCollector, $eventDispatcher) {
foreach ($this->findApplicableComposers($view, $eventDispatcher) as $composer) {
$viewComposerCollector->addViewComposer($view, $composer);
}
});
$debugBar->addCollector($viewComposerCollector);
}
示例2: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$configPath = __DIR__ . '/../config/debugbar.php';
$this->mergeConfigFrom($configPath, 'debugbar');
$this->app->alias('DebugBar\\DataFormatter\\DataFormatter', 'DebugBar\\DataFormatter\\DataFormatterInterface');
$this->app->singleton('debugbar', function ($app) {
$debugbar = new LaravelDebugbar($app);
$sessionManager = $app['session'];
$httpDriver = new SymfonyHttpDriver($sessionManager);
$debugbar->setHttpDriver($httpDriver);
return $debugbar;
});
$this->app->alias('debugbar', 'Barryvdh\\Debugbar\\LaravelDebugbar');
$this->app['command.debugbar.clear'] = $this->app->share(function ($app) {
return new Console\ClearCommand($app['debugbar']);
});
$this->commands(array('command.debugbar.clear'));
}
示例3: offsetUnset
/**
*
*
* @static
*/
public static function offsetUnset($key)
{
//Method inherited from \DebugBar\DebugBar
return \Barryvdh\Debugbar\LaravelDebugbar::offsetUnset($key);
}
示例4: debug
/**
* Based on Twig_Extension_Debug / twig_var_dump
* (c) 2011 Fabien Potencier
*
* @param Twig_Environment $env
* @param $context
*/
public function debug(Twig_Environment $env, $context)
{
if (!$env->isDebug() || !$this->debugbar) {
return;
}
$count = func_num_args();
if (2 === $count) {
$data = [];
foreach ($context as $key => $value) {
if (is_object($value)) {
if (method_exists($value, 'toArray')) {
$data[$key] = $value->toArray();
} else {
$data[$key] = "Object (" . get_class($value) . ")";
}
} else {
$data[$key] = $value;
}
}
$this->debugbar->addMessage($data);
} else {
for ($i = 2; $i < $count; $i++) {
$this->debugbar->addMessage(func_get_arg($i));
}
}
return;
}
示例5: register
/**
* @param EntityManagerInterface $em
* @param Configuration $configuration
*/
public function register(EntityManagerInterface $em, Configuration $configuration)
{
if ($this->debugbar->hasCollector('doctrine')) {
$debugStack = $this->debugbar->getCollector('doctrine')->getDebugStack();
} else {
$debugStack = new DebugStack();
$this->debugbar->addCollector(new DoctrineCollector($debugStack));
}
$configuration->setSQLLogger($debugStack);
}
示例6: handle
/**
* Handle an incoming request.
*
* @param Request $request
* @param Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
try {
/** @var \Illuminate\Http\Response $response */
$response = $next($request);
} catch (Exception $e) {
$response = $this->handleException($request, $e);
}
// Modify the response to add the Debugbar
$this->debugbar->modifyResponse($request, $response);
return $response;
}
示例7: stopDebugMeasure
/**
* @param string $name
*/
protected function stopDebugMeasure($name)
{
if ($this->debugBar) {
$this->debugBar->stopMeasure($name);
}
}