Skip to content

Commit 65b3f6a

Browse files
committed
Get all classes < 500 lines
Appeasing SensioLabs Insight
1 parent 28dd37d commit 65b3f6a

4 files changed

Lines changed: 61 additions & 60 deletions

File tree

Debug.php

Lines changed: 6 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @package PHPDebugConsole
66
* @author Brad Kent <bkfake-github@yahoo.com>
77
* @license http://opensource.org/licenses/MIT MIT
8-
* @version v1.2
8+
* @version v1.2.1
99
*
1010
* @link http://www.github.com/bkdotcom/PHPDebugConsole
1111
* @link https://developer.mozilla.org/en-US/docs/Web/API/console
@@ -170,7 +170,7 @@ public function error()
170170
*/
171171
public function get($path)
172172
{
173-
$path = $this->translateCfgKeys($path);
173+
$path = $this->utilities->translateCfgKeys($path);
174174
$path = preg_split('#[\./]#', $path);
175175
if (isset($this->{$path[0]}) && is_object($this->{$path[0]}) && isset($path[1])) {
176176
// child class config value
@@ -359,7 +359,7 @@ public function set($path, $newVal = null)
359359
{
360360
$ret = null;
361361
$new = array();
362-
$path = $this->translateCfgKeys($path);
362+
$path = $this->utilities->translateCfgKeys($path);
363363
if (is_string($path)) {
364364
$ret = $this->get($path);
365365
// build $new array from the passed string
@@ -515,7 +515,7 @@ public function time($label = null)
515515
* If label is not passed, timer is removed from no-label tack
516516
*
517517
* @param string $label unique label
518-
* @param boolean $return = false. If true, only return elapsed time rather than log it
518+
* @param boolean $return = false. If true, only return time, rather than log it
519519
*
520520
* @return float
521521
*/
@@ -548,7 +548,7 @@ public function timeEnd($label = null, $return = false)
548548
* Get the running time without stopping/pausing the timer
549549
*
550550
* @param string $label unique label
551-
* @param boolean $return = false. If true, only return elapsed time rather than log it
551+
* @param boolean $return = false. If true, only return time, rather than log it
552552
* @param integer $precision rounding precision (pass null for no rounding)
553553
*
554554
* @return float
@@ -702,6 +702,7 @@ protected function appendLog($method, $args)
702702
// path if via ErrorHandler :
703703
// ErrorHandler::handleUnsuppressed -> call_user_function -> self::onError -> self::warn -> here we are
704704
$viaErrorHandler = isset($backtrace[4])
705+
&& isset($backtrace[4]['class'])
705706
&& $backtrace[4]['class'] == 'bdk\Debug\ErrorHandler'
706707
&& $backtrace[4]['function'] == 'handleUnsuppressed'
707708
&& $backtrace[3]['function'] == 'call_user_func'
@@ -790,56 +791,4 @@ protected function appendLogFile($args)
790791
}
791792
return;
792793
}
793-
794-
/**
795-
* translate configuration keys
796-
*
797-
* @param mixed $mixed string key or config array
798-
*
799-
* @return mixed
800-
*/
801-
protected function translateCfgKeys($mixed)
802-
{
803-
$objKeys = array(
804-
'varDump' => array('addBR'),
805-
'errorHandler' => array('lastError'),
806-
'output' => array(
807-
'css', 'filepathCss', 'filepathScript', 'firephpInc', 'firephpOptions',
808-
'onOutput', 'outputAs', 'outputCss', 'outputScript',
809-
),
810-
);
811-
if (is_string($mixed)) {
812-
$path = preg_split('#[\./]#', $mixed);
813-
foreach ($objKeys as $objKey => $keys) {
814-
if (in_array($path[0], $keys)) {
815-
array_unshift($path, $objKey);
816-
break;
817-
}
818-
}
819-
if (count($path)==1) {
820-
array_unshift($path, 'debug');
821-
}
822-
$mixed = implode('/', $path);
823-
} elseif (is_array($mixed)) {
824-
foreach ($mixed as $k => $v) {
825-
if (is_array($v)) {
826-
continue;
827-
}
828-
$translated = false;
829-
foreach ($objKeys as $objKey => $keys) {
830-
if (in_array($k, $keys)) {
831-
unset($mixed[$k]);
832-
$mixed[$objKey][$k] = $v;
833-
$translated = true;
834-
break;
835-
}
836-
}
837-
if (!$translated) {
838-
unset($mixed[$k]);
839-
$mixed['debug'][$k] = $v;
840-
}
841-
}
842-
}
843-
return $mixed;
844-
}
845794
}

ErrorHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @package PHPDebugConsole
66
* @author Brad Kent <bkfake-github@yahoo.com>
77
* @license http://opensource.org/licenses/MIT MIT
8-
* @version v1.2
8+
* @version v1.2.1
99
*/
1010

1111
namespace bdk\Debug;

Output.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @package PHPDebugConsole
66
* @author Brad Kent <bkfake-github@yahoo.com>
77
* @license http://opensource.org/licenses/MIT MIT
8-
* @version v1.2
8+
* @version v1.2.1
99
*/
1010

1111
namespace bdk\Debug;

Utilities.php

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @package PHPDebugConsole
66
* @author Brad Kent <bkfake-github@yahoo.com>
77
* @license http://opensource.org/licenses/MIT MIT
8-
* @version v1.2
8+
* @version v1.2.1
99
*/
1010

1111
namespace bdk\Debug;
@@ -313,6 +313,58 @@ public function toUtf8($str)
313313
return $str;
314314
}
315315

316+
/**
317+
* translate configuration keys
318+
*
319+
* @param mixed $mixed string key or config array
320+
*
321+
* @return mixed
322+
*/
323+
public function translateCfgKeys($mixed)
324+
{
325+
$objKeys = array(
326+
'varDump' => array('addBR'),
327+
'errorHandler' => array('lastError'),
328+
'output' => array(
329+
'css', 'filepathCss', 'filepathScript', 'firephpInc', 'firephpOptions',
330+
'onOutput', 'outputAs', 'outputCss', 'outputScript',
331+
),
332+
);
333+
if (is_string($mixed)) {
334+
$path = preg_split('#[\./]#', $mixed);
335+
foreach ($objKeys as $objKey => $keys) {
336+
if (in_array($path[0], $keys)) {
337+
array_unshift($path, $objKey);
338+
break;
339+
}
340+
}
341+
if (count($path)==1) {
342+
array_unshift($path, 'debug');
343+
}
344+
$mixed = implode('/', $path);
345+
} elseif (is_array($mixed)) {
346+
foreach ($mixed as $k => $v) {
347+
if (is_array($v)) {
348+
continue;
349+
}
350+
$translated = false;
351+
foreach ($objKeys as $objKey => $keys) {
352+
if (in_array($k, $keys)) {
353+
unset($mixed[$k]);
354+
$mixed[$objKey][$k] = $v;
355+
$translated = true;
356+
break;
357+
}
358+
}
359+
if (!$translated) {
360+
unset($mixed[$k]);
361+
$mixed['debug'][$k] = $v;
362+
}
363+
}
364+
}
365+
return $mixed;
366+
}
367+
316368
/**
317369
* Use to unserialize the log serialized by emailLog
318370
*

0 commit comments

Comments
 (0)