| 1 |
lars |
1 |
<?php
|
|
|
2 |
/* vim: set expandtab tabstop=4 shiftwidth=4: */
|
|
|
3 |
// +----------------------------------------------------------------------+
|
|
|
4 |
// | PHP version 4 |
|
|
|
5 |
// +----------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (c) 1997-2006 The PHP Group |
|
|
|
7 |
// +----------------------------------------------------------------------+
|
|
|
8 |
// | This source file is subject to version 3.0 of the PHP license, |
|
|
|
9 |
// | that is bundled with this package in the file LICENSE, and is |
|
|
|
10 |
// | available through the world-wide-web at the following url: |
|
|
|
11 |
// | http://www.php.net/license/3_0.txt. |
|
|
|
12 |
// | If you did not receive a copy of the PHP license and are unable to |
|
|
|
13 |
// | obtain it through the world-wide-web, please send a note to |
|
|
|
14 |
// | license@php.net so we can mail you a copy immediately. |
|
|
|
15 |
// +----------------------------------------------------------------------+
|
|
|
16 |
// | Authors: Frederic Poeydomenge <fpoeydomenge@free.fr> |
|
|
|
17 |
// +----------------------------------------------------------------------+
|
|
|
18 |
|
|
|
19 |
/**
|
|
|
20 |
* Wrapper for the var_dump function.
|
|
|
21 |
*
|
|
|
22 |
* " The var_dump function displays structured information about expressions
|
|
|
23 |
* that includes its type and value. Arrays are explored recursively
|
|
|
24 |
* with values indented to show structure. "
|
|
|
25 |
*
|
|
|
26 |
* The Var_Dump class captures the output of the var_dump function,
|
|
|
27 |
* by using output control functions, and then uses external renderer
|
|
|
28 |
* classes for displaying the result in various graphical ways :
|
|
|
29 |
* simple text, HTML/XHTML text, HTML/XHTML table, XML, ...
|
|
|
30 |
*
|
|
|
31 |
* @category PHP
|
|
|
32 |
* @package Var_Dump
|
|
|
33 |
* @author Frederic Poeydomenge <fpoeydomenge@free.fr>
|
|
|
34 |
* @copyright 1997-2006 The PHP Group
|
|
|
35 |
* @license http://www.php.net/license/3_0.txt PHP License 3.0
|
|
|
36 |
* @version CVS: $Id: Renderer.php 233111 2007-04-02 09:38:10Z fredericpoeydome $
|
|
|
37 |
* @link http://pear.php.net/package/Var_Dump
|
|
|
38 |
*/
|
|
|
39 |
|
|
|
40 |
/**
|
|
|
41 |
* A loader class for the renderers.
|
|
|
42 |
*
|
|
|
43 |
* @category PHP
|
|
|
44 |
* @package Var_Dump
|
|
|
45 |
* @author Frederic Poeydomenge <fpoeydomenge@free.fr>
|
|
|
46 |
* @copyright 1997-2006 The PHP Group
|
|
|
47 |
* @license http://www.php.net/license/3_0.txt PHP License 3.0
|
|
|
48 |
* @version CVS: $Id: Renderer.php 233111 2007-04-02 09:38:10Z fredericpoeydome $
|
|
|
49 |
* @link http://pear.php.net/package/Var_Dump
|
|
|
50 |
*/
|
|
|
51 |
|
|
|
52 |
class Var_Dump_Renderer
|
|
|
53 |
{
|
|
|
54 |
|
|
|
55 |
/**
|
|
|
56 |
* Attempt to return a concrete Var_Dump_Renderer instance.
|
|
|
57 |
*
|
|
|
58 |
* @param string $mode Name of the renderer.
|
|
|
59 |
* @param array $options Parameters for the rendering.
|
|
|
60 |
* @access public
|
|
|
61 |
*/
|
|
|
62 |
function & factory($mode, $options)
|
|
|
63 |
{
|
|
|
64 |
@include_once 'Var_Dump/Renderer/' . $mode . '.php';
|
|
|
65 |
$className = 'Var_Dump_Renderer_' . $mode;
|
|
|
66 |
if (class_exists($className)) {
|
|
|
67 |
$obj = new $className($options);
|
|
|
68 |
} else {
|
|
|
69 |
include_once 'PEAR.php';
|
|
|
70 |
PEAR::raiseError('Var_Dump: renderer "' . $mode . '" not found', TRUE);
|
|
|
71 |
return NULL;
|
|
|
72 |
}
|
|
|
73 |
return $obj;
|
|
|
74 |
}
|
|
|
75 |
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
?>
|