From 2bf9504cfbeb9eb8d3fe800c32b107f19ba4ac58 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Mon, 19 Apr 2010 00:10:22 -0400 Subject: [PATCH] Removing inheritance from Object. Adding missing visibility keywords, and adding static keywords. Removing @tags. --- cake/libs/debugger.php | 33 +++++++++---------------- cake/tests/cases/libs/debugger.test.php | 3 --- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/cake/libs/debugger.php b/cake/libs/debugger.php index 07873cd94..cf803a2a2 100644 --- a/cake/libs/debugger.php +++ b/cake/libs/debugger.php @@ -24,9 +24,6 @@ * Included libraries. * */ -if (!class_exists('Object')) { - require_once LIBS . 'object.php'; -} if (!class_exists('CakeLog')) { require_once LIBS . 'cake_log.php'; } @@ -43,7 +40,7 @@ if (!class_exists('String')) { * @subpackage cake.cake.libs * @link http://book.cakephp.org/view/1191/Using-the-Debugger-Class */ -class Debugger extends Object { +class Debugger { /** * A list of errors generated by the application. @@ -109,7 +106,6 @@ class Debugger extends Object { * Holds current output data when outputFormat is false. * * @var string - * @access private */ protected $_data = array(); @@ -180,7 +176,7 @@ class Debugger extends Object { * @access public * @static */ - function &getInstance($class = null) { + public static function &getInstance($class = null) { static $instance = array(); if (!empty($class)) { if (!$instance || strtolower($class) != strtolower(get_class($instance[0]))) { @@ -208,11 +204,10 @@ class Debugger extends Object { * @param $var mixed the variable to dump * @return void * @see Debugger::exportVar() - * @access public * @static * @link http://book.cakephp.org/view/1191/Using-the-Debugger-Class */ - function dump($var) { + public static function dump($var) { $_this =& Debugger::getInstance(); pr($_this->exportVar($var)); } @@ -227,7 +222,7 @@ class Debugger extends Object { * @static * @link http://book.cakephp.org/view/1191/Using-the-Debugger-Class */ - function log($var, $level = LOG_DEBUG) { + public static function log($var, $level = LOG_DEBUG) { $_this =& Debugger::getInstance(); $source = $_this->trace(array('start' => 1)) . "\n"; CakeLog::write($level, "\n" . $source . $_this->exportVar($var)); @@ -330,11 +325,10 @@ class Debugger extends Object { * * @param array $options Format for outputting stack trace * @return mixed Formatted stack trace - * @access public * @static * @link http://book.cakephp.org/view/1191/Using-the-Debugger-Class */ - function trace($options = array()) { + public static function trace($options = array()) { $_this =& Debugger::getInstance(); $defaults = array( 'depth' => 999, @@ -410,10 +404,9 @@ class Debugger extends Object { * * @param string $path Path to shorten * @return string Normalized path - * @access public * @static */ - function trimPath($path) { + public static function trimPath($path) { if (!defined('CAKE_CORE_INCLUDE_PATH') || !defined('APP')) { return $path; } @@ -442,11 +435,10 @@ class Debugger extends Object { * @param integer $line Line number to highlight * @param integer $context Number of lines of context to extract above and below $line * @return array Set of lines highlighted - * @access public * @static * @link http://book.cakephp.org/view/1191/Using-the-Debugger-Class */ - function excerpt($file, $line, $context = 2) { + public static function excerpt($file, $line, $context = 2) { $data = $lines = array(); if (!file_exists($file)) { return array(); @@ -475,11 +467,10 @@ class Debugger extends Object { * * @param string $var Variable to convert * @return string Variable as a formatted string - * @access public * @static * @link http://book.cakephp.org/view/1191/Using-the-Debugger-Class */ - function exportVar($var, $recursion = 0) { + public static function exportVar($var, $recursion = 0) { $_this =& Debugger::getInstance(); switch (strtolower(gettype($var))) { case 'boolean': @@ -563,7 +554,7 @@ class Debugger extends Object { * straight HTML output, or 'txt' for unformatted text. * @param array $strings Template strings to be used for the output format. */ - protected function output($format = null, $strings = array()) { + public function output($format = null, $strings = array()) { $_this =& Debugger::getInstance(); $data = null; @@ -601,9 +592,8 @@ class Debugger extends Object { * Renders error messages * * @param array $data Data about the current error - * @access private */ - function _output($data = array()) { + protected function _output($data = array()) { $defaults = array( 'level' => 0, 'error' => 0, @@ -674,10 +664,9 @@ class Debugger extends Object { /** * Verifies that the application's salt and cipher seed value has been changed from the default value. * - * @access public * @static */ - function checkSecurityKeys() { + public static function checkSecurityKeys() { if (Configure::read('Security.salt') == 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi') { trigger_error(__('Please change the value of \'Security.salt\' in app/config/core.php to a salt value specific to your application'), E_USER_NOTICE); } diff --git a/cake/tests/cases/libs/debugger.test.php b/cake/tests/cases/libs/debugger.test.php index 2b6ce2e4f..393b0a2c8 100644 --- a/cake/tests/cases/libs/debugger.test.php +++ b/cake/tests/cases/libs/debugger.test.php @@ -251,9 +251,6 @@ class DebuggerTest extends CakeTestCase { View::$modelId = NULL View::$uuids = array View::$output = false - View::$__passedVars = array - View::$__scripts = array - View::$__paths = array View::$webroot = NULL'; $result = str_replace(array("\t", "\r\n", "\n"), "", strtolower($result)); $expected = str_replace(array("\t", "\r\n", "\n"), "", strtolower($expected));