当前位置: 首页>>代码示例>>PHP>>正文


PHP Tracy\Helpers类代码示例

本文整理汇总了PHP中Tracy\Helpers的典型用法代码示例。如果您正苦于以下问题:PHP Helpers类的具体用法?PHP Helpers怎么用?PHP Helpers使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Helpers类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPanel

    public function getPanel()
    {
        $duplicitesQueries = $this->getDuplicateQueries();
        if (empty($duplicitesQueries)) {
            return '';
        }
        $panel = '
		<div class="tracy-inner nette-DbDuplicatesQueries">
			<table>
				<tr><th>Count</th><th>SQL Query</th><th>Locations</th></tr>';
        foreach ($duplicitesQueries as $query => $dupliciteQuery) {
            $panel .= '<tr>';
            $count = count($dupliciteQuery);
            $panel .= '<td>' . $count . 'x</td>';
            $panel .= '<td>' . $query . '</td>';
            $panel .= '<td>';
            foreach ($dupliciteQuery as $queryInformation) {
                $source = $queryInformation[1];
                if (!$source) {
                    continue;
                }
                $panel .= substr_replace(Tracy\Helpers::editorLink($source[0], $source[1]), ' class="nette-DbConnectionPanel-source"', 2, 0) . '<br />';
            }
            $panel .= '</td>';
            $panel .= '</tr>';
        }
        $panel .= '
			</table>
		</div>';
        return $panel;
    }
开发者ID:RELIGIS,项目名称:DuplicateQueriesPanel,代码行数:31,代码来源:DuplicateQueriesPanel.php

示例2: fixStack

 /**
  * render.
  *
  * @method render
  *
  * @param \Exception $exception
  * @param array $error
  *
  * @return \Exception
  */
 protected function fixStack($exception, $error)
 {
     if (in_array($error['type'], [E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE, E_RECOVERABLE_ERROR, E_USER_ERROR], true) === true) {
         return Helpers::fixStack(new ErrorException($error['message'], 0, $error['type'], $error['file'], $error['line']));
     }
     return $exception;
 }
开发者ID:recca0120,项目名称:laravel-tracy,代码行数:17,代码来源:BlueScreen.php

示例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]));
             }
         }
     });
 }
开发者ID:petrparolek,项目名称:web_cms,代码行数:27,代码来源:TracyBridge.php

示例4: log

 public function log($message, $priority = self::INFO)
 {
     $parent = parent::log($message, $priority);
     $checked = array(self::CRITICAL, self::ERROR);
     if (defined('self::EXCEPTION')) {
         $checked[] = self::EXCEPTION;
     }
     if (in_array($priority, $checked, TRUE)) {
         $index = NULL;
         $trace = debug_backtrace(FALSE);
         if (!Tracy\Helpers::findTrace($trace, 'Tracy\\Debugger::log', $index)) {
             if (!Tracy\Helpers::findTrace($trace, 'Nette\\Diagnostics\\Debugger::log', $index)) {
                 Tracy\Helpers::findTrace($trace, 'log', $index);
             }
         }
         $errorTrace = $trace[$index + 1];
         //get trace for _errorHandler call
         $exceptionTrace = $trace[$index];
         //get trace for _exception or ::log call
         //if()
         $exception = NULL;
         if (isset($errorTrace['args']) && count($errorTrace['args']) == 5) {
             $exception = new \ErrorException($errorTrace['args'][1], 0, $errorTrace['args'][0], $errorTrace['args'][2], $errorTrace['args'][3]);
         } elseif (!empty($exceptionTrace['args']) && !empty($exceptionTrace['args'][0]) && $exceptionTrace['args'][0] instanceof \Exception) {
             $exception = $exceptionTrace['args'][0];
         }
         if ($exception) {
             $error = Consumerr::addError($exception);
             if ($error && is_array($message)) {
                 $error->addData('file', Tracy\Debugger::$logDirectory . '/' . substr($message[3], 5));
             }
         }
     }
     return $parent;
 }
开发者ID:consumerr,项目名称:nette,代码行数:35,代码来源:Logger.php

示例5: renderHtml

 private function renderHtml()
 {
     $res = '<style>code, pre {white-space:nowrap} a {text-decoration:none} pre {color:gray;display:inline} big {color:red}</style><code>';
     foreach ($this->list as $item) {
         $res .= Helpers::editorLink($item[0], $item[1]) . ' ' . str_replace(self::BOM, '<big>BOM</big>', Dumper::toHtml($item[2])) . "<br>\n";
     }
     return $res . '</code>';
 }
开发者ID:petrparolek,项目名称:web_cms,代码行数:8,代码来源:OutputDebugger.php

示例6: highlightException

 /**
  * @param \Kdyby\Autowired\Exception $e
  * @return string
  */
 protected static function highlightException(Kdyby\Autowired\Exception $e)
 {
     $refl = $e->getReflector();
     /** @var \Reflector|\Nette\Reflection\Property|\Nette\Reflection\Method $refl */
     $file = $refl->getDeclaringClass()->getFileName();
     $line = $refl instanceof Nette\Reflection\Property ? self::getPropertyLine($refl) : $refl->getStartLine();
     return '<p><b>File:</b> ' . Helpers::editorLink($file, $line) . '</p>' . BlueScreen::highlightFile($file, $line);
 }
开发者ID:kdyby,项目名称:autowired,代码行数:12,代码来源:Panel.php

示例7: log

 public function log($message, $priority = self::INFO)
 {
     $context = ['at' => Helpers::getSource()];
     if ($message instanceof Throwable) {
         $context['exception'] = $message;
         $message = '';
     }
     $this->monolog->addRecord(self::PRIORITY_MAP[$priority] ?? Monolog\Logger::ERROR, $message, $context);
 }
开发者ID:nextras,项目名称:tracy-monolog-adapter,代码行数:9,代码来源:Logger.php

示例8: formatMessage

 /**
  * @author David Grudl
  * @see    https://github.com/nette/tracy
  */
 protected static function formatMessage(Throwable $message) : string
 {
     $tmp = [];
     while ($message) {
         $tmp[] = ($message instanceof \ErrorException ? Helpers::errorTypeToString($message->getSeverity()) . ': ' . $message->getMessage() : Helpers::getClass($message) . ': ' . $message->getMessage()) . ' in ' . $message->getFile() . ':' . $message->getLine();
         $message = $message->getPrevious();
     }
     $message = implode($tmp, "\ncaused by ");
     return trim($message);
 }
开发者ID:nextras,项目名称:tracy-monolog-adapter,代码行数:14,代码来源:TracyExceptionProcessor.php

示例9: highlightFile

	/**
	 * Returns syntax highlighted source code.
	 * @param  string
	 * @param  int
	 * @param  int
	 * @return string
	 */
	public static function highlightFile($file, $line, $lines = 15, array $vars = NULL)
	{
		$source = @file_get_contents($file); // intentionally @
		if ($source) {
			$source = static::highlightPhp($source, $line, $lines, $vars);
			if ($editor = Helpers::editorUri($file, $line)) {
				$source = substr_replace($source, ' data-tracy-href="' . htmlspecialchars($editor, ENT_QUOTES, 'UTF-8') . '"', 4, 0);
			}
			return $source;
		}
	}
开发者ID:nakoukal,项目名称:fakturace,代码行数:18,代码来源:BlueScreen.php

示例10: renderException

 public static function renderException($e)
 {
     if (!$e instanceof \PDOException) {
         return;
     }
     if (isset($e->queryString)) {
         $sql = $e->queryString;
     } elseif ($item = Tracy\Helpers::findTrace($e->getTrace(), 'PDO::prepare')) {
         $sql = $item['args'][0];
     }
     return isset($sql) ? ['tab' => 'SQL', 'panel' => Helpers::dumpSql($sql)] : NULL;
 }
开发者ID:ricco24,项目名称:database,代码行数:12,代码来源:ConnectionPanel.php

示例11: renderHtml

 private function renderHtml()
 {
     $res = '<style>code, pre {white-space:nowrap} a {text-decoration:none} pre {color:gray;display:inline} big {color:red}</style><code>';
     foreach ($this->list as $item) {
         $stack = array();
         foreach (array_slice($item[3], 1) as $t) {
             $t += array('class' => '', 'type' => '', 'function' => '');
             $stack[] = "{$t['class']}{$t['type']}{$t['function']}()" . (isset($t['file'], $t['line']) ? ' in ' . basename($t['file']) . ":{$t['line']}" : '');
         }
         $res .= Helpers::editorLink($item[0], $item[1]) . ' ' . '<span title="' . htmlspecialchars(implode("\n", $stack), ENT_IGNORE | ENT_QUOTES, 'UTF-8') . '">' . str_replace(self::BOM, '<big>BOM</big>', Dumper::toHtml($item[2])) . "</span><br>\n";
     }
     return $res . '</code>';
 }
开发者ID:re1la2pse,项目名称:GromesProjekt,代码行数:13,代码来源:OutputDebugger.php

示例12: 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])];
         }
     });
 }
开发者ID:pt24,项目名称:bootstrap,代码行数:19,代码来源:TracyBridge.php

示例13: 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]));
             }
         }
     });
 }
开发者ID:hrach,项目名称:nette,代码行数:19,代码来源:TracyBridge.php

示例14: getPanel

    public function getPanel()
    {
        $this->disabled = TRUE;
        $s = '';
        foreach ($this->queries as $query) {
            list($connection, $sql, $params, $source, $time, $rows, $error) = $query;
            $explain = NULL;
            // EXPLAIN is called here to work SELECT FOUND_ROWS()
            if (!$error && $this->explain && preg_match('#\\s*\\(?\\s*SELECT\\s#iA', $sql)) {
                try {
                    $cmd = is_string($this->explain) ? $this->explain : 'EXPLAIN';
                    $explain = $connection->queryArgs("{$cmd} {$sql}", $params)->fetchAll();
                } catch (\PDOException $e) {
                }
            }
            $s .= '<tr><td>';
            if ($error) {
                $s .= '<span title="' . htmlSpecialChars($error, ENT_IGNORE | ENT_QUOTES) . '">ERROR</span>';
            } elseif ($time !== NULL) {
                $s .= sprintf('%0.3f', $time * 1000);
            }
            if ($explain) {
                static $counter;
                $counter++;
                $s .= "<br /><a class='tracy-toggle tracy-collapsed' href='#nette-DbConnectionPanel-row-{$counter}'>explain</a>";
            }
            $s .= '</td><td class="nette-DbConnectionPanel-sql">' . Helpers::dumpSql($sql, $params, $connection);
            if ($explain) {
                $s .= "<table id='nette-DbConnectionPanel-row-{$counter}' class='tracy-collapsed'><tr>";
                foreach ($explain[0] as $col => $foo) {
                    $s .= '<th>' . htmlSpecialChars($col) . '</th>';
                }
                $s .= '</tr>';
                foreach ($explain as $row) {
                    $s .= '<tr>';
                    foreach ($row as $col) {
                        $s .= '<td>' . htmlSpecialChars($col) . '</td>';
                    }
                    $s .= '</tr>';
                }
                $s .= '</table>';
            }
            if ($source) {
                $s .= substr_replace(Tracy\Helpers::editorLink($source[0], $source[1]), ' class="nette-DbConnectionPanel-source"', 2, 0);
            }
            $s .= '</td><td>' . $rows . '</td></tr>';
        }
        return $this->count ? '<style class="tracy-debug"> #tracy-debug td.nette-DbConnectionPanel-sql { background: white !important }
			#tracy-debug .nette-DbConnectionPanel-source { color: #BBB !important } </style>
			<h1 title="' . htmlSpecialChars($connection->getDsn()) . '">Queries: ' . $this->count . ($this->totalTime ? sprintf(', time: %0.3f ms', $this->totalTime * 1000) : '') . ', ' . htmlSpecialChars($this->name) . '</h1>
			<div class="tracy-inner nette-DbConnectionPanel">
			<table>
				<tr><th>Time&nbsp;ms</th><th>SQL Query</th><th>Rows</th></tr>' . $s . '
			</table>' . (count($this->queries) < $this->count ? '<p>...and more</p>' : '') . '</div>' : '';
    }
开发者ID:romanvlcek,项目名称:wifimap,代码行数:55,代码来源:ConnectionPanel.php

示例15: getEditorLink

 public static function getEditorLink($source)
 {
     $link = null;
     if ($source !== null) {
         $file = $source[0];
         $line = $source[1];
         $link = Helpers::editorLink($file, $line);
         // $link = self::updateEditorUri($link);
     }
     return $link;
 }
开发者ID:dasim,项目名称:laravel-tracy,代码行数:11,代码来源:AbstractPanel.php


注:本文中的Tracy\Helpers类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。