diff --git a/classes/Profiler.php b/classes/Profiler.php
index d855cbc..6693216 100644
--- a/classes/Profiler.php
+++ b/classes/Profiler.php
@@ -33,17 +33,6 @@
*/
class Profiler
{
- /**
- * Config
- *
- * Profiler configuration
- *
- * @static
- * @access private
- * @var array
- */
- private static $config;
-
/**
* Profile
*
@@ -53,7 +42,7 @@ class Profiler
* @access private
* @var array
*/
- private static $profile = array();
+ private static $profile = [];
/**
* Queries
@@ -75,19 +64,7 @@ class Profiler
* @access private
* @var array
*/
- private static $timers = array();
-
- /**
- * Constructor
- *
- * Private constructor since this class is interfaced wtih statically.
- *
- * @access private
- */
- private function __construct()
- {
-
- }
+ private static $timers = [];
/**
* Enabled
@@ -100,15 +77,11 @@ class Profiler
*/
public static function enabled(/* polymorphic */)
{
- // Grabs the config object if we don't have one yet
- if (self::$config == null)
- {
- $config = Config::getInstance();
- self::$config = $config->pickles['profiler'];
- }
+ $config = Config::getInstance();
+ $config = $config->pickles['profiler'];
// Checks if we're set to boolean true
- if (self::$config === true)
+ if ($config === true)
{
return true;
}
@@ -118,7 +91,7 @@ class Profiler
foreach ($types as $type)
{
- if (stripos(self::$config, $type) !== false)
+ if (stripos($config, $type) !== false)
{
return true;
}
@@ -178,13 +151,13 @@ class Profiler
break;
}
- self::$profile[] = array(
+ self::$profile[] = [
'log' => $log,
'type' => $data_type,
'time' => $time,
'elapsed' => $time - $_SERVER['REQUEST_TIME_FLOAT'],
'memory' => memory_get_usage(),
- );
+ ];
}
/**
@@ -206,11 +179,11 @@ class Profiler
if ($input_parameters != 'false' && is_array($input_parameters))
{
- $log .= '
';
+ $log .= '
';
foreach ($input_parameters as $key => $value)
{
- $log .= '
' . $key . ' => ' . $value . '';
+ $log .= '
' . $key . ' => ' . $value . '';
$query = str_replace($key, '' . $key . '', $query);
}
@@ -220,19 +193,19 @@ class Profiler
if (is_array($explain))
{
- $log .= '
';
+ $log .= '
';
foreach ($explain as $table)
{
- $log .= '
Possible Keys => ' . ($table['possible_keys'] == '' ? 'NONE' : $table['possible_keys']) . ''
- . '
Key => ' . ($table['key'] == '' ? 'NONE' : $table['key']) . ''
- . '
Type => ' . $table['type'] . ''
- . '
Rows => ' . $table['rows'] . ''
- . ($table['Extra'] != '' ? '
Extra => ' . $table['Extra'] . '' : '');
+ $log .= '
Possible Keys => ' . ($table['possible_keys'] == '' ? 'NONE' : $table['possible_keys']) . ''
+ . '
Key => ' . ($table['key'] == '' ? 'NONE' : $table['key']) . ''
+ . '
Type => ' . $table['type'] . ''
+ . '
Rows => ' . $table['rows'] . ''
+ . ($table['Extra'] != '' ? '
Extra => ' . $table['Extra'] . '' : '');
}
}
- $log .= '
Speed: ' . number_format($duration * 100, 3) . ' ms';
+ $log .= '
Speed: ' . number_format($duration * 100, 3) . ' ms';
self::log($log, false, 'database');
}
@@ -275,6 +248,8 @@ class Profiler
* Generates the Profiler report that is displayed by the Controller.
* Contains all the HTML needed to display the data properly inline on the
* page. Will generally be displayed after the closing HTML tag.
+ *
+ * @todo Thinking this should return the report and not necessarily echo it
*/
public static function report()
{
@@ -317,7 +292,7 @@ class Profiler
}