-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDebug.php
51 lines (43 loc) · 1.06 KB
/
Debug.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
* --------------------------------
* PEL - Phalcon Extensions Library
* --------------------------------
*
* This code is distributed under New BSD license.
* License is bundled with this package in file LICENSE.txt.
*
* @author Jiri Pazdernik <[email protected]>
*/
namespace Pel;
/**
* Class for debug appliaction and symbols
*
* @author Jiri Pazdernik <[email protected]>
*/
class Debug
{
/**
* Dump specific variable
*
* @param mixed $var variable to dump
* @param string $label (OPTIONAL) text of user defined label
* @param boolean $echo (OPTIONAL) FALSE for suppress print of the dump
* @param boolean $wrapPre (OPTIONAL) FALSE for not to wrap content with <pre> tag
* @return string information about dumped variable
*/
public static function dump($var, $label = null, $echo = true, $wrapPre = true)
{
ob_start();
var_dump($var);
$r = ob_get_clean();
$result = $label . " " . $r;
if ($wrapPre) {
$result = "<pre>" . $result . "</pre>";
}
if ($echo) {
echo $result;
}
return $result;
}
}