Skip to content

Commit

Permalink
1.2 release candidate
Browse files Browse the repository at this point in the history
for real this time

update to readme
updates to unit-test's Test class
VarDump - objects - list properties before methods
VarDump - tables - remove deprecated html attributes / move vertical
alignment to css.  fixed nested array bug
  • Loading branch information
bkdotcom committed Dec 4, 2014
1 parent f524082 commit 7fb9cad
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ public function set($path, $newVal = null)
}
if (isset($new['debug']['emailTo']) && !isset($new['errorHandler']['emailTo'])) {
// also set errorHandler's emailTo
$new['errorHandler']['emailTo'] = $new['emailTo'];
$new['errorHandler']['emailTo'] = $new['debug']['emailTo'];
}
if (isset($new['data'])) {
$this->data = array_merge($this->data, $new['data']);
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@ Browser/javascript like console class for PHP

![Screenshot of PHPDebugConsole's Output](http://www.bradkent.com/images/bradkent.com/php/screenshot.png)

### Installation
This library requires PHP 5.0 or later (PHP 5.2 to "catch" fatal errors), and has no userland dependencies.

It is installable and autoloadable via [Composer](https://getcomposer.org/) as [bdk/debug](https://packagist.org/packages/bdk/debug).

```json
{
"require": {
"bdk/debug": "~1.2",
}
}
```
Alternatively, [download a release](https://github.com/bkdotcom/debug/releases) or clone this repository, then require or include its `Debug.php`_ file

See http://www.bradkent.com/?page=php/debug for more information

### Methods

* log
Expand All @@ -27,6 +43,7 @@ Browser/javascript like console class for PHP
* timeEnd
* *… [more](http://www.bradkent.com/?page=php/debug#docs-methods)*

### Quality
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/789295b4-6040-4367-8fd5-b04a6f0d7a0c/big.png)](https://insight.sensiolabs.com/projects/789295b4-6040-4367-8fd5-b04a6f0d7a0c)

### Changelog
Expand Down
12 changes: 6 additions & 6 deletions VarDump.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public function dumpTable($array, $caption = null)
$str = '<div class="log">'.$str.'</div>';
} else {
$keys = $this->utilities->arrayColKeys($array);
$str = '<table cellpadding="1" cellspacing="0" border="1">'."\n" // style="border:solid 1px;"
$str = '<table>'."\n"
.'<caption>'.$caption.'</caption>'."\n";
$values = array();
foreach ($keys as $key) {
Expand Down Expand Up @@ -326,7 +326,7 @@ protected function dumpTableRow($keys, $row, $rowKey)
$value = $row;
}
if (is_array($value)) {
$value = call_user_func(array($this,__FUNCTION__), $value);
$value = $this->dumpTable($value);
} elseif ($value === $undefined) {
$value = '<span class="t_undefined"></span>';
} else {
Expand All @@ -339,7 +339,7 @@ protected function dumpTableRow($keys, $row, $rowKey)
$class = $matches[1];
$rowKey = $matches[2];
}
$str .= '<tr valign="top"><td class="'.$class.'">'.$rowKey.'</td>';
$str .= '<tr><td class="'.$class.'">'.$rowKey.'</td>';
foreach ($values as $v) {
// remove the span wrapper.. add span's class to TD
$class = null;
Expand Down Expand Up @@ -406,8 +406,8 @@ protected function getValueAbstraction($val, $opts = array(), $hist = array())
);
if ($opts['html'] || $opts['flatten']) {
$val = $val['class']."\n"
.' methods: '.$val['methods']."\n"
.' properties: '.$val['properties'];
.' properties: '.$val['properties']."\n"
.' methods: '.$val['methods'];
if ($opts['flatten'] && count($hist) > 1) {
$val = str_replace("\n", "\n ", $val);
}
Expand Down Expand Up @@ -459,7 +459,7 @@ protected function getValueHtml($val, $type = null, $typeMore = null)
'<span class="t_object-class">\1</span>'."\n".'<span class="t_object-inner">\2</span>',
$val
);
$html = preg_replace('#\sproperties: #', '<br />properties: ', $html);
$html = preg_replace('#\smethods: #', '<br />methods: ', $html);
$val = '<span class="t_'.$type.'">'.$html.'</span>';
} elseif ($type) {
$attribs = array(
Expand Down
2 changes: 1 addition & 1 deletion css/Debug.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
.debug table { border-collapse:collapse; }
.debug table caption { font-weight:bold; font-style:italic; }
.debug table th { font-weight:bold; background-color: rgba(0,0,0,0.1); }
.debug table th, .debug table td { border:1px solid #000; padding:1px .25em; }
.debug table th, .debug table td { border:1px solid #000; padding:1px .25em; vertical-align:top; }
.debug ul { margin-top: 0; margin-bottom: 0; }

.debug .alert {
Expand Down
52 changes: 51 additions & 1 deletion tests/Test.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,61 @@
<?php

namespace bdk\Debug;

define('SOMECONSTANT', 'Constant value');

/**
* Test
*/
class Test
{

/**
* Test var comment
*/
public $propPublic = 'iAmPublic';
private $propPrivate = 'iAmPrivate';
private $propProtected = 'iAmProtected';
protected $propProtected = 'iAmProtected';

/**
* This method is public
*
* @param mixed $param1 first param (passed by ref)
* @param mixed $param2 second param (passed by ref)
* two-line description!
* @param array $param3 third param
*
* @return void
* @deprecated
*/
public function methodPublic(&$param1, &$param2 = SOMECONSTANT, array $param3 = array())
{

}

/**
* This method is private
*
* @param mixed $param1 first param
* @param boolean $moreParams variadic param
*
* @return void
*/
private function methodPrivate($param1, ...$moreParams)
{

}

/**
* This method is protected
*
* @param mixed $param1 first param
* @param mixed $moreParams variadic param by reference
*
* @return void
*/
protected function methodProtected($param1, &...$moreParams)
{

}
}

0 comments on commit 7fb9cad

Please sign in to comment.