Browse Source

Modified Profiler message.

master
Alexander Demidov 13 years ago
parent
commit
9d0e22ebd2
  1. 2
      tests/util/profiler/ProfilerTest.php
  2. 8
      util/profiler/Profiler.php

2
tests/util/profiler/ProfilerTest.php

@ -39,7 +39,7 @@ class ProfilerTest extends PHPUnit_Framework_TestCase
public function testGetInstaceNoDebug()
{
Config::set('PROFILER', false);
$this->setExpectedException('GeneralException', 'Need to turn on PROFILER before use.');
$this->setExpectedException('GeneralException', 'Need turn PROFILER before use.');
Profiler::getInstance();
}

8
util/profiler/Profiler.php

@ -23,7 +23,7 @@ class Profiler
private function __construct()
{
if (Config::get('PROFILER') == false) {
throw new GeneralException('Need to turn on PROFILER before use.');
throw new GeneralException('Need turn PROFILER before use.');
}
}
@ -82,7 +82,7 @@ class Profiler
$html = '<div style="clear:both; font:12px monospace; margin: 5px; white-space: pre;">'
. 'Elapsed time: ' . round(($this->end - $this->start) * 1000, 2) . 'ms.<br/>';
if (count($this->queries) == 0 && !Config::get('PROFILER_DETAILS')) {
$html .= 'Queries not counted. Turn PROFILER_DETAILS on true, if you want to profile queries.<br>';
$html .= 'Queries not counted. Turn PROFILER_DETAILS if you want to profile queries.<br/>';
} else {
$html .= 'Queries: ' . count($this->queries) . ' [' . round($queriesTime * 1000, 2) . ' ms]<br/>';
}
@ -104,7 +104,7 @@ class Profiler
$queriesTime += $query->getElapsed();
}
if (count($this->queries) == 0 && !Config::get('PROFILER_DETAILS')) {
FB::table('Queries not counted. Turn PROFILER_DETAILS on true, if you want to profile queries.', $table);
FB::table('Queries not counted. Turn PROFILER_DETAILS if you want to profile queries.', $table);
} else {
FB::table('Queries: ' . count($this->queries) . ' [' . round($queriesTime * 1000, 2) . ' ms]', $table);
}
@ -122,7 +122,7 @@ class Profiler
$html = str_pad(PHP_EOL, 60, '-', STR_PAD_LEFT);
$html .= 'Elapsed time: ' . round(($this->end - $this->start) * 1000, 2) . 'ms.' . PHP_EOL;
if (count($this->queries) == 0 && !Config::get('PROFILER_DETAILS')) {
$html .= 'Queries not counted. Turn PROFILER_DETAILS on true, if you want to profile queries.' . PHP_EOL;
$html .= 'Queries not counted. Turn PROFILER_DETAILS if you want to profile queries.' . PHP_EOL;
} else {
$html .= 'Queries: ' . count($this->queries) . ' [' . round($queriesTime * 1000, 2) . ' ms] ' . PHP_EOL;
}

Loading…
Cancel
Save