public function __construct($connection = null)
 {
     $config = Config::get('profiler');
     if ($config['useForensics'] != true) {
         return;
     }
     if ($connection instanceof Connection) {
         $this->connection = $connection;
     } else {
         if ($config['withDatabase'] == true) {
             $this->connection = DB::connection();
         }
     }
     // Setup the View path.
     $this->viewPath = realpath(__DIR__) . DS . 'Views' . DS . 'Profiler.php';
     // Setup the Start Time.
     $this->startTime = Request::server('REQUEST_TIME_FLOAT');
 }
 public static function getReport()
 {
     $options = Config::get('profiler');
     // Calculate the variables.
     $execTime = microtime(true) - HttpRequest::server('REQUEST_TIME_FLOAT');
     $elapsedTime = sprintf("%01.4f", $execTime);
     $memoryUsage = Number::humanSize(memory_get_usage());
     if ($options['withDatabase'] == true) {
         $connection = DB::connection();
         $queries = $connection->getQueryLog();
         $totalQueries = count($queries);
         $queriesStr = $totalQueries == 1 ? __d('nova', 'query') : __d('nova', 'queries');
     } else {
         $totalQueries = 0;
         $queriesStr = __d('nova', 'queries');
     }
     $estimatedUsers = sprintf("%0d", intval(25 / $execTime));
     //
     $retval = __d('nova', 'Elapsed Time: <b>{0}</b> sec | Memory Usage: <b>{1}</b> | SQL: <b>{2}</b> {3} | UMAX: <b>{4}</b>', $elapsedTime, $memoryUsage, $totalQueries, $queriesStr, $estimatedUsers);
     return $retval;
 }