Skip to content

Document new environment variables and display options #7217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 15, 2017
Next Next commit
Document new environment variables and display options
  • Loading branch information
sawmurai committed Dec 3, 2016
commit 7b26e4482011cc00c455e99fc297b32b49fb2f51
22 changes: 21 additions & 1 deletion components/var_dumper/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ Dumpers

A dumper is responsible for outputting a string representation of a PHP variable,
using a :class:`Symfony\\Component\\VarDumper\\Cloner\\Data` object as input.
The destination and the formatting of this output vary with dumpers.
The destination and the formatting of this output vary with dumpers and are
influenced by two environment variables:
If ``DUMP_STRING_LENGTH`` is set, then
the length of a string is displayed next to its content.
If ``DUMP_LIGHT_ARRAY`` is set,
then arrays are not displayed completely.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to render the two sentences as a list? This would then look like this:

The destination and the formatting of this output vary with dumpers and are
influenced by two environment variables:

* If ``DUMP_STRING_LENGTH`` is set, then the length of a string is displayed
  next to its content.
* If ``DUMP_LIGHT_ARRAY`` is set, then arrays are not displayed completely.


This component comes with an :class:`Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper`
for HTML output and a :class:`Symfony\\Component\\VarDumper\\Dumper\\CliDumper`
Expand Down Expand Up @@ -181,6 +186,21 @@ method. They also typically implement the
them from re-implementing the logic required to walk through a
:class:`Symfony\\Component\\VarDumper\\Cloner\\Data` object's internal structure.

The HTMLDumper limits string length and nesting depth of the output.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should enclose HTMLDumper with double backticks and change it to HtmlDumper to reflect the actual class name.

These options can be overriden by providing a third parameter when calling ``dump``::

use Symfony\Component\VarDumper\Dumper\HtmlDumper;

$output = fopen('php://memory', 'r+b');

$dumper = new HtmlDumper();
$dumper->dump($var, $output, array(
'maxDepth' => 1,
'maxStringLength' => 160
));

// Limit nesting to 1 level and string length to 160 characters (default)

Casters
-------

Expand Down