| 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: Common.php 233111 2007-04-02 09:38:10Z fredericpoeydome $
|
|
|
37 |
* @link http://pear.php.net/package/Var_Dump
|
|
|
38 |
*/
|
|
|
39 |
|
|
|
40 |
/**
|
|
|
41 |
* A base class for Var_Dump renderers, must be inherited by all such.
|
|
|
42 |
*
|
|
|
43 |
* All common methods are declared here. If a given renderer contains
|
|
|
44 |
* a particular method, that method will overload the one here.
|
|
|
45 |
*
|
|
|
46 |
* @category PHP
|
|
|
47 |
* @package Var_Dump
|
|
|
48 |
* @author Frederic Poeydomenge <fpoeydomenge@free.fr>
|
|
|
49 |
* @copyright 1997-2006 The PHP Group
|
|
|
50 |
* @license http://www.php.net/license/3_0.txt PHP License 3.0
|
|
|
51 |
* @version CVS: $Id: Common.php 233111 2007-04-02 09:38:10Z fredericpoeydome $
|
|
|
52 |
* @link http://pear.php.net/package/Var_Dump
|
|
|
53 |
*/
|
|
|
54 |
|
|
|
55 |
class Var_Dump_Renderer_Common
|
|
|
56 |
{
|
|
|
57 |
|
|
|
58 |
/**
|
|
|
59 |
* Run-time configuration options.
|
|
|
60 |
*
|
|
|
61 |
* @var array
|
|
|
62 |
* @access public
|
|
|
63 |
*/
|
|
|
64 |
var $options = array();
|
|
|
65 |
|
|
|
66 |
/**
|
|
|
67 |
* Default configuration options.
|
|
|
68 |
*
|
|
|
69 |
* See Var_Dump/Renderer/*.php for the complete list of options
|
|
|
70 |
*
|
|
|
71 |
* @var array
|
|
|
72 |
* @access public
|
|
|
73 |
*/
|
|
|
74 |
var $defaultOptions = array();
|
|
|
75 |
|
|
|
76 |
/**
|
|
|
77 |
* Array containing the element family : start/finish group, start/finish element
|
|
|
78 |
*
|
|
|
79 |
* @var array
|
|
|
80 |
* @access public
|
|
|
81 |
*/
|
|
|
82 |
var $family;
|
|
|
83 |
|
|
|
84 |
/**
|
|
|
85 |
* Array containing the element depths
|
|
|
86 |
*
|
|
|
87 |
* @var array
|
|
|
88 |
* @access public
|
|
|
89 |
*/
|
|
|
90 |
var $depth;
|
|
|
91 |
|
|
|
92 |
/**
|
|
|
93 |
* Array containing the element types
|
|
|
94 |
*
|
|
|
95 |
* @var array
|
|
|
96 |
* @access public
|
|
|
97 |
*/
|
|
|
98 |
var $type;
|
|
|
99 |
|
|
|
100 |
/**
|
|
|
101 |
* Array containing the element values
|
|
|
102 |
*
|
|
|
103 |
* @var array
|
|
|
104 |
* @access public
|
|
|
105 |
*/
|
|
|
106 |
var $value;
|
|
|
107 |
|
|
|
108 |
/**
|
|
|
109 |
* Array containing the strlen of keys for all the nested arrays
|
|
|
110 |
*
|
|
|
111 |
* @var array
|
|
|
112 |
* @access public
|
|
|
113 |
*/
|
|
|
114 |
var $keyLen;
|
|
|
115 |
|
|
|
116 |
/**
|
|
|
117 |
* Set run-time configuration options for the renderer
|
|
|
118 |
*
|
|
|
119 |
* @param array $options Run-time configuration options.
|
|
|
120 |
* @access public
|
|
|
121 |
*/
|
|
|
122 |
function setOptions($options = array())
|
|
|
123 |
{
|
|
|
124 |
$this->options = array_merge($this->defaultOptions, $options);
|
|
|
125 |
}
|
|
|
126 |
|
|
|
127 |
/**
|
|
|
128 |
* Initialize internal data structures for the rendering.
|
|
|
129 |
*
|
|
|
130 |
* @param array $family Containing the element family.
|
|
|
131 |
* @param array $depth Containing the element depths.
|
|
|
132 |
* @param array $type Containing the element types.
|
|
|
133 |
* @param array $value Containing the element values.
|
|
|
134 |
* @param array $keyLen Strlen of keys for all the nested arrays
|
|
|
135 |
* @access public
|
|
|
136 |
*/
|
|
|
137 |
function initialize(& $family, & $depth, & $type, & $value, & $keyLen)
|
|
|
138 |
{
|
|
|
139 |
$this->family = $family;
|
|
|
140 |
$this->depth = $depth;
|
|
|
141 |
$this->type = $type;
|
|
|
142 |
$this->value = $value;
|
|
|
143 |
$this->keyLen = $keyLen;
|
|
|
144 |
}
|
|
|
145 |
|
|
|
146 |
/**
|
|
|
147 |
* Returns the string representation of a variable
|
|
|
148 |
*
|
|
|
149 |
* @return string The string representation of the variable.
|
|
|
150 |
* @access public
|
|
|
151 |
* @abstract
|
|
|
152 |
*/
|
|
|
153 |
function toString()
|
|
|
154 |
{
|
|
|
155 |
}
|
|
|
156 |
|
|
|
157 |
}
|
|
|
158 |
|
|
|
159 |
?>
|