本文整理汇总了PHP中Tracy\Debugger::getBar方法的典型用法代码示例。如果您正苦于以下问题:PHP Debugger::getBar方法的具体用法?PHP Debugger::getBar怎么用?PHP Debugger::getBar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tracy\Debugger
的用法示例。
在下文中一共展示了Debugger::getBar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
public function register(ORM &$db)
{
Debugger::getBar()->addPanel($this);
$db->debug = function ($query, $parameters, $microtime = null) {
self::getInstance()->logQuery($query, $parameters, $microtime);
};
}
示例2: register
public static function register(Cron $cron, Request $request)
{
$bar = Debugger::getBar();
$panel = new static($cron, $request);
$bar->addPanel($panel);
return $panel;
}
示例3: initialize
public static function initialize()
{
$blueScreen = Tracy\Debugger::getBlueScreen();
if (preg_match('#(.+)/Bridges/Framework$#', strtr(__DIR__, '\\', '/'), $m)) {
if (preg_match('#(.+)/nette/bootstrap/src$#', $m[1], $m2)) {
$blueScreen->collapsePaths[] = "{$m2['1']}/nette";
$blueScreen->collapsePaths[] = "{$m2['1']}/latte";
} else {
$blueScreen->collapsePaths[] = $m[1];
}
}
if (class_exists('Nette\\Framework')) {
$bar = Tracy\Debugger::getBar();
$bar->info[] = $blueScreen->info[] = 'Nette Framework ' . Nette\Framework::VERSION . ' (' . Nette\Framework::REVISION . ')';
}
$blueScreen->addPanel(function ($e) {
if ($e instanceof Latte\CompileException) {
return array('tab' => 'Template', 'panel' => '<p>' . (is_file($e->sourceName) ? '<b>File:</b> ' . Helpers::editorLink($e->sourceName, $e->sourceLine) : htmlspecialchars($e->sourceName)) . '</p>' . ($e->sourceCode ? '<pre>' . BlueScreen::highlightLine(htmlspecialchars($e->sourceCode), $e->sourceLine) . '</pre>' : ''));
} elseif ($e instanceof Nette\Neon\Exception && preg_match('#line (\\d+)#', $e->getMessage(), $m)) {
if ($item = Helpers::findTrace($e->getTrace(), 'Nette\\DI\\Config\\Adapters\\NeonAdapter::load')) {
return array('tab' => 'NEON', 'panel' => '<p><b>File:</b> ' . Helpers::editorLink($item['args'][0], $m[1]) . '</p>' . BlueScreen::highlightFile($item['args'][0], $m[1]));
} elseif ($item = Helpers::findTrace($e->getTrace(), 'Nette\\Neon\\Decoder::decode')) {
return array('tab' => 'NEON', 'panel' => BlueScreen::highlightPhp($item['args'][0], $m[1]));
}
}
});
}
示例4: createGuzzleClient
/**
* @param $tempDir
* @param array $guzzleConfig
* @return \GuzzleHttp\Client
* @throws \Matyx\Guzzlette\GuzzletteException
*/
public static function createGuzzleClient($tempDir, $guzzleConfig = [])
{
if (isset(static::$client)) {
return static::$client;
}
if (Tracy\Debugger::isEnabled()) {
$handler = NULL;
if (isset($guzzleConfig['handler'])) {
$handler = $guzzleConfig['handler'];
if (!$handler instanceof GuzzleHttp\HandlerStack) {
throw new GuzzletteException("Handler must be instance of " . GuzzleHttp\HandlerStack::class);
}
} else {
$handler = GuzzleHttp\HandlerStack::create();
}
$requestStack = new RequestStack();
Tracy\Debugger::getBar()->addPanel(new TracyPanel($tempDir, $requestStack));
$handler->push(function (callable $handler) use($requestStack) {
return function ($request, array $options) use($handler, $requestStack) {
Tracy\Debugger::timer();
$guzzletteRequest = new Request();
$guzzletteRequest->request = $request;
return $handler($request, $options)->then(function ($response) use($requestStack, $guzzletteRequest) {
$guzzletteRequest->time = Tracy\Debugger::timer();
$guzzletteRequest->response = $response;
$requestStack->addRequest($guzzletteRequest);
return $response;
});
};
});
$guzzleConfig['handler'] = $handler;
}
static::$client = new GuzzleHttp\Client($guzzleConfig);
return static::$client;
}
示例5: getBarResponse
public static function getBarResponse()
{
ob_start();
TracyDebugger::getBar()->render();
$content = ob_get_clean();
return $content;
}
示例6: register
/**
* Register the bar and register the event which will block the screen log
*/
public static function register()
{
$class = new self();
Events::addListener(array($class, 'screenLogEventListener'), 'screenLogEvent', EventPriority::NORMAL);
$bar = Debugger::getBar();
$bar->addPanel($class);
}
示例7: register
/**
* Register this panel
*
* @param \Pagewiser\Idn\Nette\Api $idnApi IDN Api
* @param int $layout Layout type
* @param int $height Popup height
*
* @return NULL
*/
public function register(\Pagewiser\Idn\Nette\Api $idnApi, $layout = NULL, $height = NULL)
{
$this->idnApi = $idnApi;
Tracy\Debugger::getBar()->addPanel($this);
$idnApi->onCurlCall[] = array($this, 'onCurlCall');
$idnApi->onCurlFinished[] = array($this, 'onCurlFinished');
$idnApi->onCurlFailed[] = array($this, 'onCurlFailed');
}
示例8: register
/**
* @param Toggler $toggler
*/
public function register(Toggler $toggler)
{
$this->toggler = $toggler;
$this->toggler->onFeatureEvaluated[] = function ($feature, $context, $conditions, $result) {
$this->evaluatedFeatures[] = ['feature' => $feature, 'context' => $context, 'conditions' => $conditions, 'result' => $result];
};
Debugger::getBar()->addPanel($this);
}
示例9: handleGetExceptionLogFile
public function handleGetExceptionLogFile()
{
if (Debugger::isEnabled() && Debugger::getBar()) {
$presenter = $this->getPresenter(true);
echo file_exists($filename = $presenter->getParameter('file')) ? file_get_contents($filename) : '"' . $this->getParameter('file') . '" not found.';
$presenter->terminate();
}
}
示例10: sendExceptionLogFile
/**
* @param Application $sender
* @param \Exception $e
*/
public static function sendExceptionLogFile(Nette\Application\Application $sender, \Exception $e)
{
/** @var $presenter Presenter */
if (Debugger::isEnabled() && Debugger::getBar() && ($presenter = $sender->getPresenter()) && preg_match('/exceptionLogFile/', $e->getMessage())) {
echo file_exists($filename = $presenter->getParameter('file')) ? $presenter->payload->dibiPanel = file_get_contents($filename) : '"' . $presenter->getParameter('file') . '" not found.';
//Debugger::$bar = false;
die;
}
}
示例11: __construct
/**
* __construct.
*
* @method __construct
*
* @param array $config
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Contracts\Foundation\Application $app
*/
public function __construct($config, Request $request = null, Application $app = null)
{
$this->request = is_null($request) === true ? Request::capture() : $request;
$this->ajax = $this->request->ajax();
$this->app = $app;
$this->accepts = Arr::get($config, 'accepts', []);
$this->showBar = Arr::get($config, 'showBar', false);
$this->bar = Debugger::getBar();
$this->initializeTracyDebuger($config);
$this->loadPanels($config);
}
示例12: simpleInit
public static function simpleInit(\NotORM $notorm, PDO $pdo = null)
{
$self = self::getInstance();
$self->setNotOrm($notorm);
if ($pdo) {
$self->setPdo($pdo);
}
$notorm->debug = function ($query, $parameters) use($self) {
$self->logQuery($query, $parameters);
$self->startQueryTimer($self->getIndex());
};
$notorm->debugTimer = function () use($self) {
$self->stopQueryTimer($self->getIndex());
};
$self->setPlatform($pdo->getAttribute(PDO::ATTR_DRIVER_NAME));
Debugger::getBar()->addPanel($self);
}
示例13: fetch
/**
* Fetch template
*
* @param string $file
* @param array $data (optional)
* @param int|string|array $cache (optional)
* @return string
*/
public function fetch($file, $data = [], $cache = NULL)
{
// Remap cache
if (is_int($data) === TRUE) {
$cache = $data;
$data = [];
}
// Cache params (used only for select)
list($cacheId, $cacheLifetime) = array_values($this->cacheDefaults());
if (is_array($cache)) {
list($cacheId, $cacheLifetime) = array_merge(['id' => $cacheId, 'lifetime' => $cacheLifetime], $cache);
} elseif (is_int($cache) || $cache instanceof \DateTime) {
$cacheLifetime = $cache;
} elseif (is_string($cache)) {
$cacheId = $cache;
}
$cache = (bool) $cacheLifetime === TRUE ? TRUE : NULL;
// Get item from cache
if ($cache !== NULL) {
$cacheDb = $this->call->cache();
$cacheObj = $cacheDb->pool('/view/' . $cacheId);
$template = $cacheDb->get($cacheObj);
}
// Check if cache is enabled and item is cached
if ($cache === NULL || $cacheDb->isCached($cacheObj) === FALSE) {
// Lock item in cache during processing data
if ($cache !== NULL) {
$cacheDb->lock($cacheObj);
}
// Assign smarty templates
if (count($data) !== 0) {
$this->smarty->assign($data);
}
$template = $this->smarty->fetch($file);
// Save to cache
if ($cache !== NULL) {
$cacheDb->set($cacheObj, $template, $cacheLifetime);
}
}
// Tracy panel
if (TRACY === TRUE && Debugger::$productionMode === FALSE) {
Debugger::getBar()->addPanel($panel = new SmartyBarPanel($this->smarty));
}
return $template;
}
示例14: initialize
public static function initialize()
{
$blueScreen = Tracy\Debugger::getBlueScreen();
if (class_exists('Nette\\Framework')) {
$version = Framework::VERSION . (Framework::REVISION ? ' (' . Framework::REVISION . ')' : '');
Tracy\Debugger::getBar()->getPanel('Tracy:info')->data['Nette Framework'] = $version;
$blueScreen->info[] = "Nette Framework {$version}";
}
$blueScreen->addPanel(function ($e) {
if ($e instanceof Latte\CompileException) {
return ['tab' => 'Template', 'panel' => (@is_file($e->sourceName) ? '<p><b>File:</b> ' . Helpers::editorLink($e->sourceName, $e->sourceLine) . '</p>' : '') . '<pre>' . BlueScreen::highlightLine(htmlspecialchars($e->sourceCode, ENT_IGNORE, 'UTF-8'), $e->sourceLine) . '</pre>'];
}
});
$blueScreen->addPanel(function ($e) {
if ($e instanceof Nette\Neon\Exception && preg_match('#line (\\d+)#', $e->getMessage(), $m) && ($trace = Helpers::findTrace($e->getTrace(), 'Nette\\Neon\\Decoder::decode'))) {
return ['tab' => 'NEON', 'panel' => ($trace2 = Helpers::findTrace($e->getTrace(), 'Nette\\DI\\Config\\Adapters\\NeonAdapter::load')) ? '<p><b>File:</b> ' . Helpers::editorLink($trace2['args'][0], $m[1]) . '</p>' . BlueScreen::highlightFile($trace2['args'][0], $m[1]) : BlueScreen::highlightPhp($trace['args'][0], $m[1])];
}
});
}
示例15: initialize
public static function initialize()
{
$bar = Tracy\Debugger::getBar();
$bar->info[] = 'Nette Framework ' . Nette\Framework::VERSION . ' (' . substr(Nette\Framework::REVISION, 8) . ')';
$blueScreen = Tracy\Debugger::getBlueScreen();
$blueScreen->collapsePaths[] = dirname(dirname(__DIR__));
$blueScreen->info[] = 'Nette Framework ' . Nette\Framework::VERSION . ' (revision ' . Nette\Framework::REVISION . ')';
$blueScreen->addPanel(function ($e) {
if ($e instanceof Latte\CompileException) {
return array('tab' => 'Template', 'panel' => '<p>' . (is_file($e->sourceName) ? '<b>File:</b> ' . Helpers::editorLink($e->sourceName, $e->sourceLine) : htmlspecialchars($e->sourceName)) . '</p>' . ($e->sourceCode ? '<pre>' . BlueScreen::highlightLine(htmlspecialchars($e->sourceCode), $e->sourceLine) . '</pre>' : ''));
} elseif ($e instanceof Nette\Utils\NeonException && preg_match('#line (\\d+)#', $e->getMessage(), $m)) {
if ($item = Helpers::findTrace($e->getTrace(), 'Nette\\DI\\Config\\Adapters\\NeonAdapter::load')) {
return array('tab' => 'NEON', 'panel' => '<p><b>File:</b> ' . Helpers::editorLink($item['args'][0], $m[1]) . '</p>' . BlueScreen::highlightFile($item['args'][0], $m[1]));
} elseif ($item = Helpers::findTrace($e->getTrace(), 'Nette\\Utils\\Neon::decode')) {
return array('tab' => 'NEON', 'panel' => BlueScreen::highlightPhp($item['args'][0], $m[1]));
}
}
});
}