Source for file Text.php
Documentation is available at Text.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2004 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.php.net/license/3_0.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Frederic Poeydomenge <frederic.poeydomenge@free.fr> |
// +----------------------------------------------------------------------+
require_once 'Var_Dump/Renderer.php';
* A concrete renderer for Var_Dump
* Returns a text-only representation of a variable
* @author Frederic Poeydomenge <frederic.poeydomenge@free.fr>
* Default configuration options.
* show_container : bool, Show the root Element or not
* mode : string, Can be one of the following displaying modes
* 'compact' = no keys alignment
* 'normal' = keys alignment, proportional spacing
* 'wide' = keys alignment, wider spacing
* offset : integer, Offset between the start of a group and the content
* opening : string, Opening character
* closing : string, Closing character
* operator : string, Operator symbol
* is_html : bool, Do we need to htmlspecialchars() the texts
* before_text : string, Text to insert before the text
* after_text : string, Text to insert after the text
* before_num_key : string, Text to insert before a numerical key
* after_num_key : string, Text to insert after a numerical key
* before_str_key : string, Text to insert before a string key
* after_str_key : string, Text to insert after a string key
* before_operator : string, Text to insert before the operator
* after_operator : string, Text to insert after the operator
* before_type : string, Text to insert before a type
* after_type : string, Text to insert after a type
* before_value : string, Text to insert before a value
* after_value : string, Text to insert after a value
'show_container' => TRUE ,
* @param array $options Parameters for the rendering.
* Returns the string representation of a variable.
* @return string The string representation of the variable.
$txt = $this->options['before_text'];
for ($c = 0 ; $c < $counter ; $c++ ) {
$offset = end($stackOffset)
if ($this->options['show_container'] or $this->depth[$c] > 0 ) {
$txt .= $this->value[$c] . ' ' . $this->options['opening'] . "\n";
if ($this->depth[$c] > 0 ) {
if ($this->options['mode'] == 'wide') {
$offset += end($stackOffset);
if (!$this->options['show_container']) {
$offset -= $this->options['offset'];
if ($this->options['show_container'] or $this->depth[$c] > 0 ) {
$txt .= $this->options['closing'] . "\n";
if ($this->depth[$c] > 0 ) {
if ($this->options['mode'] == 'wide') {
$offset += end($stackOffset);
if(!$this->options['show_container']) {
$offset -= $this->options['offset'];
if ($this->options['mode'] == 'compact') {
// offset is the value set during the previous pass in VAR_DUMP_START_ELEMENT_*
$txt .= $this->options['after_text'];
* Returns the operator symbol.
* @return string The operator symbol.
$txt = $this->options['before_operator'];
$txt .= $this->options['operator'];
$txt .= $this->options['after_operator'];
* Returns the key of the element.
* @param integer $c Index of the element.
* @return string The key of the element.
$txt = $this->options['before_'. $comp. '_key'];
$txt .= $this->value[$c];
$txt .= $this->options['after_'. $comp. '_key'];
// {{{ getFinishElement()
* Returns the value of the element.
* @param integer $c Index of the element.
* @return string The value of the element.
$txt = $this->options['before_type'];
$txt .= $this->options['after_type'];
if (!empty ($this->value[$c])) {
$txt .= ' ' . $this->options['before_value'];
$txt .= $this->value[$c];
$txt .= $this->options['after_value'];
Documentation generated on Mon, 11 Mar 2019 10:16:07 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|