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


PHP Tracy\Debugger类代码示例

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


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

示例1: dumpHtml

/**
 * Dump rendered Html element or code and intended output generated by tidy and optional also Html element structure
 *
 * @param Html|string $htmlElement        Html element or string
 * @param bool        $onlyReturn         output in string and don't send it to output?
 * @param int         $maxDepth           for Debugger::Dump output - to see how is the Html element built
 * @param bool        $includePrettyPrint along javascript code for prettyPrint activation?
 * @return string     Html output
 */
function dumpHtml($htmlElement, $onlyReturn = false, $maxDepth = 0, $includePrettyPrint = false)
{
    $maxDepthBackup = Debugger::$maxDepth;
    $maxLenBackup = Debugger::$maxLen;
    $showLocationBackup = Debugger::$showLocation;
    Debugger::$maxDepth = $maxDepth;
    Debugger::$maxLen = 200000;
    Debugger::$showLocation = false;
    // convert to string only once - important for Scaffolding Renderer output
    $renderedElement = (string) $htmlElement;
    $output = '<div class="rendered-element">' . $renderedElement . '</div>';
    $output .= '<pre class="prettyprint linenums pre-scrollable">' . htmlspecialchars(tidyFormatString($renderedElement)) . '</pre>';
    if ($includePrettyPrint) {
        $output .= '<script>prettyPrint();</script>';
    }
    if ($maxDepth > 0 && $htmlElement instanceof \Latte\Runtime\Html) {
        Debugger::dump($renderedElement);
        Debugger::dump($htmlElement);
    }
    Debugger::$maxDepth = $maxDepthBackup;
    Debugger::$maxLen = $maxLenBackup;
    Debugger::$showLocation = $showLocationBackup;
    if (!$onlyReturn) {
        echo $output;
    }
    return $output;
}
开发者ID:leonardoca,项目名称:tools,代码行数:36,代码来源:smartDump.php

示例2: pmd

/**
 * LeonardoCA\Tools\ProcessMonitor detail dump
 *
 * @param string $msg
 * @param null   $data
 * @param null   $dataDescription
 * @param int    $maxDepth
 * @return void
 */
function pmd($msg = 'Detail Info', $data = null, $dataDescription = null, $maxDepth = 2)
{
    $backupDepth = Debugger::$maxDepth;
    Debugger::$maxDepth = $maxDepth;
    ProcessMonitor::dump("<em style='color:#339'>{$msg}</em>", $data, null, ProcessMonitor::SHOW_DETAIL, $dataDescription);
    Debugger::$maxDepth = $backupDepth;
}
开发者ID:leonardoca,项目名称:tools,代码行数:16,代码来源:processMonitor.php

示例3: process

 /**
  * Default form handler
  */
 public function process()
 {
     /** @var ArrayHash $values */
     $values = $this->values;
     try {
         $this->onBeforeProcess($this, $values);
         if (isset($values->id)) {
             $this->onBeforeUpdate($this, $values);
             $arr = (array) $values;
             unset($arr['id']);
             $row = $this->selection->wherePrimary($values->id)->fetch();
             $row->update($arr);
             $this->onAfterUpdate($row, $this, $values);
         } else {
             $this->onBeforeInsert($this, $values);
             $row = $this->selection->insert($values);
             $this->onAfterInsert($row, $this, $values);
         }
         $this->onAfterProcess($row, $this, $values);
     } catch (\PDOException $e) {
         $this->addError($e->getMessage());
         dump($e);
         Debugger::log($e);
     }
 }
开发者ID:ondrs,项目名称:nette-bootstrap,代码行数:28,代码来源:BaseForm.php

示例4: renderDefault

 public function renderDefault()
 {
     $this->template->anyVariable = 'any value';
     //		$dao = $this->articles;
     $this->template->articles = $this->articles->getArticles()->findAll();
     $posts = $this->EntityManager->getRepository(Posts::getClassName());
     $this->template->posts = $posts->findAll();
     $this->template->myparametr = $this->context->parameters['first_parametr'];
     //		$this->template->test = $this->doSomeRefactoring('Hello world from blog');
     //		$post = new Posts();
     //		$post->title = 'New title';
     //		$post->text = 'New text New textNew text';
     //		$post->created_at = new \Nette\Utils\DateTime;
     //
     //
     //		$this->EntityManager->persist($post);
     //		$this->EntityManager->flush();
     //		$dao = $this->EntityManager->getRepository(Posts::getClassName());
     //		$dao->setTitle('test');
     //		$dao->__call('set', ['title' => 'my title']);
     //		dump($dao->__isset('title'));
     //		$dao->__set('title', 'test');
     try {
         $this->checkNum(2);
         \Tracy\Debugger::barDump('If you see this, the number is 1 or below');
     } catch (Nette\Application\BadRequestException $e) {
         Debugger::log('Message: ' . $e->getMessage());
         var_dump($e->getMessage());
     }
     //		finally {
     //			\Tracy\Debugger::barDump('Got here Finally');
     //		}
 }
开发者ID:regiss,项目名称:doctrine-sand,代码行数:33,代码来源:Blog.php

示例5: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     Debugger::timer();
     $output->writeln('Running tests...');
     $runner = new Runner();
     $path = realpath($input->getArgument('path'));
     if ($path) {
         if (is_dir($path)) {
             $runner->setTestsRoot($path . '/');
             foreach (Finder::findFiles('*.php')->exclude('tester.php')->from($path) as $path => $fileInfo) {
                 $basePath = Helpers::stripExtension($path);
                 $runner->addTest($basePath);
             }
         } else {
             $basePath = Helpers::stripExtension($path);
             $runner->addTest($basePath);
         }
     } else {
         if ($path = realpath($input->getArgument('path') . '.php')) {
             $basePath = Helpers::stripExtension($path);
             $runner->addTest($basePath);
         } else {
             $output->writeln("<error>The given path isn't valid</error>");
             return 1;
         }
     }
     $runner->setOutput($output);
     $runner->runTests();
     $output->writeln('Completed in ' . round(Debugger::timer(), 2) . ' seconds');
     if ($runner->failed()) {
         return 1;
     } else {
         return 0;
     }
 }
开发者ID:blocka,项目名称:php2js,代码行数:35,代码来源:TestCommand.php

示例6: __init

 public function __init($directory = NULL, $email = NULL, BlueScreen $blueScreen = NULL)
 {
     if (!$directory) {
         $directory = __DIR__ . "/../log/";
     }
     if (getenv("MONDA_DEBUG")) {
         if (array_key_exists(getenv("MONDA_DEBUG"), self::$levels)) {
             self::$loglevel = self::$levels[getenv("MONDA_DEBUG")];
             Debugger::$productionMode = false;
         } else {
             self::log("Unknown log level!\n", Debugger::ERROR);
         }
     } else {
         if (Options::get("debug")) {
             if (array_key_exists(Options::get("debug"), self::$levels)) {
                 self::$loglevel = self::$levels[Options::get("debug")];
                 Debugger::$productionMode = false;
             } else {
                 self::log("Unknown log level!\n", Debugger::ERROR);
             }
         }
     }
     self::$wwwlogger = new \Tracy\Logger($directory, $email, $blueScreen);
     if (PHP_SAPI == "cli") {
         if (Options::get("logfile")) {
             self::$logfd = fopen(Options::get("logfile"), "w");
         } else {
             self::$logfd = STDERR;
         }
     }
 }
开发者ID:jiang51,项目名称:monda,代码行数:31,代码来源:CliLogger.php

示例7: handleRequest

 private function handleRequest(React\Http\Request $request, React\Http\Response $response)
 {
     try {
         $container = $this->containerFactory->createContainer();
         /** @var HttpRequestFactory $requestFactory */
         $requestFactory = $container->getByType(HttpRequestFactory::class);
         $requestFactory->setFakeHttpRequest($this->createNetteHttpRequest($request));
         /** @var CliRouter $router */
         $cliRouter = $container->getService('console.router');
         $cliRouter->setIsCli(FALSE);
         /** @var Nette\Application\Application $application */
         $application = $container->getByType(Nette\Application\Application::class);
         array_unshift($application->onError, function () {
             throw new AbortException();
         });
         ob_start();
         $application->run();
         $responseBody = ob_get_contents();
         ob_end_clean();
         $response->writeHead(200, array('Content-Type' => 'text/html; charset=utf-8'));
         $response->end($responseBody);
     } catch (\Exception $e) {
         Debugger::log($e, Debugger::EXCEPTION);
         $response->writeHead(500, array('Content-Type' => 'text/plain'));
         $response->end('Internal Server Error');
     }
 }
开发者ID:gorocacher,项目名称:react-http-server-sandbox,代码行数:27,代码来源:RunCommand.php

示例8: importDataToStagingTable

 protected function importDataToStagingTable($stagingTableName, $columns, $sourceData)
 {
     if (!isset($sourceData['schemaName'])) {
         throw new Exception('Invalid source data. schemaName must be set', Exception::INVALID_SOURCE_DATA);
     }
     if (!isset($sourceData['tableName'])) {
         throw new Exception('Invalid source data. schemaName must be set', Exception::INVALID_SOURCE_DATA);
     }
     $sql = "INSERT INTO " . $this->nameWithSchemaEscaped($stagingTableName) . " (" . implode(', ', array_map(function ($column) {
         return $this->quoteIdentifier($column);
     }, $columns)) . ") ";
     $sql .= "SELECT " . implode(',', array_map(function ($column) {
         return $this->quoteIdentifier($column);
     }, $columns)) . " FROM " . $this->nameWithSchemaEscaped($sourceData['tableName'], $sourceData['schemaName']);
     try {
         Debugger::timer('copyToStaging');
         $this->connection->query($sql);
         $rows = $this->connection->fetchAll(sprintf('SELECT COUNT(*) as "count" from %s.%s', $this->connection->quoteIdentifier($this->schemaName), $this->connection->quoteIdentifier($stagingTableName)));
         $this->importedRowsCount += (int) $rows[0]['count'];
         $this->addTimer('copyToStaging', Debugger::timer('copyToStaging'));
     } catch (\Exception $e) {
         // everything is user error
         throw new Exception($e->getMessage(), Exception::UNKNOWN_ERROR, $e);
     }
 }
开发者ID:keboola,项目名称:php-db-import,代码行数:25,代码来源:CopyImport.php

示例9: onBootstrap

 /**
  * {@inheritDoc}
  */
 public function onBootstrap(EventInterface $event)
 {
     /**
      * @var ModuleOptions $moduleOptions
      */
     $moduleOptions = $event->getTarget()->getServiceManager()->get('LemoTracy\\Options\\ModuleOptions');
     if (true === $moduleOptions->getEnabled()) {
         if (null !== $moduleOptions->getMode()) {
             Debugger::enable($moduleOptions->getMode());
         }
         if (null !== $moduleOptions->getLogDirectory()) {
             Debugger::$logDirectory = $moduleOptions->getLogDirectory();
         }
         if (null !== $moduleOptions->getLogSeverity()) {
             Debugger::$logSeverity = $moduleOptions->getLogSeverity();
         }
         if (null !== $moduleOptions->getMaxDepth()) {
             Debugger::$maxDepth = $moduleOptions->getMaxDepth();
         }
         if (null !== $moduleOptions->getMaxLen()) {
             Debugger::$maxLen = $moduleOptions->getMaxLen();
         }
         if (null !== $moduleOptions->getShowBar()) {
             Debugger::$showBar = $moduleOptions->getShowBar();
         }
         if (null !== $moduleOptions->getStrict()) {
             Debugger::$strictMode = $moduleOptions->getStrict();
         }
     }
 }
开发者ID:MatyCZ,项目名称:LemoTracy,代码行数:33,代码来源:Module.php

示例10: importDataToStagingTable

 protected function importDataToStagingTable($stagingTempTableName, $columns, $sourceData, array $options = [])
 {
     if (!isset($sourceData['schemaName'])) {
         throw new Exception('Invalid source data. schemaName must be set', Exception::INVALID_SOURCE_DATA);
     }
     if (!isset($sourceData['tableName'])) {
         throw new Exception('Invalid source data. schemaName must be set', Exception::INVALID_SOURCE_DATA);
     }
     $sourceColumnTypes = $this->describeTable(strtolower($sourceData['tableName']), strtolower($sourceData['schemaName']));
     $sql = "INSERT INTO " . $this->tableNameEscaped($stagingTempTableName) . " (" . implode(', ', array_map(function ($column) {
         return $this->quoteIdentifier($column);
     }, $columns)) . ") ";
     $sql .= "SELECT " . implode(',', array_map(function ($column) use($sourceColumnTypes) {
         if ($sourceColumnTypes[$column]['DATA_TYPE'] === 'bool') {
             return sprintf('DECODE(%s, true, 1, 0) ', $this->quoteIdentifier($column));
         } else {
             return "COALESCE(CAST({$this->quoteIdentifier($column)} as varchar), '') ";
         }
     }, $columns)) . " FROM " . $this->nameWithSchemaEscaped($sourceData['tableName'], $sourceData['schemaName']);
     try {
         Debugger::timer('copyToStaging');
         $this->query($sql);
         $this->addTimer('copyToStaging', Debugger::timer('copyToStaging'));
     } catch (\Exception $e) {
         if (strpos($e->getMessage(), 'Datatype mismatch') !== false) {
             throw new Exception($e->getMessage(), Exception::DATA_TYPE_MISMATCH, $e);
         }
         // everything is user error
         throw new Exception($e->getMessage(), Exception::UNKNOWN_ERROR, $e);
     }
 }
开发者ID:keboola,项目名称:php-db-import,代码行数:31,代码来源:CopyImportRedshift.php

示例11: formSucceeded

 /**
  * Callback for ForgottenPasswordForm onSuccess event.
  * @param Form      $form
  * @param ArrayHash $values
  */
 public function formSucceeded(Form $form, $values)
 {
     $user = $this->userManager->findByEmail($values->email);
     if (!$user) {
         $form->addError('No user with given email found');
         return;
     }
     $password = Nette\Utils\Random::generate(10);
     $this->userManager->setNewPassword($user->id, $password);
     try {
         // !!! Never send passwords through email !!!
         // This is only for demonstration purposes of Notejam.
         // Ideally, you can create a unique link where user can change his password
         // himself for limited amount of time, and then send the link.
         $mail = new Nette\Mail\Message();
         $mail->setFrom('noreply@notejamapp.com', 'Notejamapp');
         $mail->addTo($user->email);
         $mail->setSubject('New notejam password');
         $mail->setBody(sprintf('Your new password: %s', $password));
         $this->mailer->send($mail);
     } catch (Nette\Mail\SendException $e) {
         Debugger::log($e, Debugger::EXCEPTION);
         $form->addError('Could not send email with new password');
     }
 }
开发者ID:martinmayer,项目名称:notejam,代码行数:30,代码来源:ForgottenPasswordFormFactory.php

示例12: register

 public static function register(Cron $cron, Request $request)
 {
     $bar = Debugger::getBar();
     $panel = new static($cron, $request);
     $bar->addPanel($panel);
     return $panel;
 }
开发者ID:foowie,项目名称:cron,代码行数:7,代码来源:Panel.php

示例13: 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;
 }
开发者ID:matyx,项目名称:guzzlette,代码行数:41,代码来源:Guzzlette.php

示例14: actionDefault

 /**
  * Provide auto merge
  */
 public function actionDefault()
 {
     $payload = $this->httpRequest->getRawBody();
     if (!$payload) {
         Debugger::log('No payload data', Debugger::ERROR);
         $this->terminate();
     }
     $data = json_decode($payload, true);
     if (!$data) {
         Debugger::log('json_decode error', Debugger::ERROR);
         $this->terminate();
     }
     if ($data['object_kind'] != 'note') {
         Debugger::log('Only notes object kind processing now. *' . $data['object_kind'] . '* given', Debugger::ERROR);
         $this->terminate();
     }
     $projectId = isset($data['merge_request']['source_project_id']) ? $data['merge_request']['source_project_id'] : false;
     $mergeRequestId = isset($data['merge_request']['id']) ? $data['merge_request']['id'] : false;
     if (!$projectId || !$mergeRequestId) {
         Debugger::log('projectId or mergeRequestId missing', Debugger::ERROR);
         $this->terminate();
     }
     $project = $this->projectRepository->findByGitlabId($projectId);
     if (!$project) {
         Debugger::log('Project ' . $projectId . ' is not allowed to auto merge', Debugger::ERROR);
         $this->terminate();
     }
     $mr = $this->gitlabClient->api('mr')->show($projectId, $mergeRequestId);
     $mergeRequest = $this->mergeRequestBuilder->create($mr, $data);
     if ($mergeRequest->canBeAutoMerged($project->positive_votes)) {
         $this->gitlabClient->api('mr')->merge($projectId, $mergeRequestId, 'Auto merged');
     }
 }
开发者ID:ricco24,项目名称:gitlab-auto-merger,代码行数:36,代码来源:WebhookPresenter.php

示例15: __construct

 public function __construct($slackUrl, IMessageFactory $messageFactory, $timeout)
 {
     parent::__construct(Debugger::$logDirectory, Debugger::$email, Debugger::getBlueScreen());
     $this->slackUrl = $slackUrl;
     $this->messageFactory = $messageFactory;
     $this->timeout = $timeout;
 }
开发者ID:greeny,项目名称:nette-slack-logger,代码行数:7,代码来源:SlackLogger.php


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