@@ -182,93 +182,92 @@ them from re-implementing the logic required to walk through a
182
182
:class: `Symfony\\ Component\\ VarDumper\\ Cloner\\ Data ` object's internal structure.
183
183
184
184
The :class: `Symfony\\ Component\\ VarDumper\\ Dumper\\ HtmlDumper ` limits string
185
- length and nesting depth of the output. These options can be overriden by
186
- providing a third parameter when calling
185
+ length and nesting depth of the output to make it more readable. These options
186
+ can be overriden by the third optional parameter of the
187
187
:method: `dump(Data $data) <Symfony\\ Component\\ VarDumper\\ Dumper\\ DataDumperInterface::dump> `
188
- ::
188
+ method ::
189
189
190
190
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
191
191
192
192
$output = fopen('php://memory', 'r+b');
193
193
194
194
$dumper = new HtmlDumper();
195
195
$dumper->dump($var, $output, array(
196
+ // 1 and 160 are the default values for these options
196
197
'maxDepth' => 1,
197
198
'maxStringLength' => 160
198
199
));
199
200
200
- // Limit nesting to 1 level and string length to 160 characters (default)
201
-
202
201
The output format of a dumper can be fine tuned by the two flags
203
202
``DUMP_STRING_LENGTH `` and ``DUMP_LIGHT_ARRAY `` which are passed as a bitmap
204
203
in the third constructor argument. They can also be set via environment
205
204
variables when using
206
205
:method: `assertDumpEquals($dump, $data, $message) <Symfony\\ Component\\ VarDumper\\ Test\\ VarDumperTestTrait::assertDumpEquals> `
207
- during unit testing. The flags can be configured in the PHPUnit configuration.
206
+ during unit testing.
208
207
209
- * If ``DUMP_STRING_LENGTH `` is set, then the length of a string is displayed
210
- next to its content.
208
+ If ``DUMP_STRING_LENGTH `` is set, then the length of a string is displayed
209
+ next to its content:
211
210
212
- .. code-block :: php
211
+ .. code-block :: php
213
212
214
- use Symfony\Component\VarDumper\Dumper\AbstractDumper;
215
- use Symfony\Component\VarDumper\Dumper\CliDumper;
213
+ use Symfony\Component\VarDumper\Dumper\AbstractDumper;
214
+ use Symfony\Component\VarDumper\Dumper\CliDumper;
216
215
217
- $var = array('test');
218
- $dumper = new CliDumper();
219
- echo $dumper->dump($var, true);
216
+ $var = array('test');
217
+ $dumper = new CliDumper();
218
+ echo $dumper->dump($var, true);
220
219
221
- // array:1 [
222
- // 0 => "test"
223
- // ]
220
+ // array:1 [
221
+ // 0 => "test"
222
+ // ]
224
223
225
- $dumper = new CliDumper(null, null, AbstractDumper::DUMP_STRING_LENGTH);
226
- echo $dumper->dump($var, true);
224
+ $dumper = new CliDumper(null, null, AbstractDumper::DUMP_STRING_LENGTH);
225
+ echo $dumper->dump($var, true);
227
226
228
- // (added string length before the string)
229
- // array:1 [
230
- // 0 => (4) "test"
231
- // ]
227
+ // (added string length before the string)
228
+ // array:1 [
229
+ // 0 => (4) "test"
230
+ // ]
232
231
233
- * If ``DUMP_LIGHT_ARRAY `` is set, then arrays are dumped in a shortened format
234
- similar to PHP's short array notation.
232
+ If ``DUMP_LIGHT_ARRAY `` is set, then arrays are dumped in a shortened format
233
+ similar to PHP's short array notation:
235
234
236
- .. code-block :: php
235
+ .. code-block :: php
237
236
238
- use Symfony\Component\VarDumper\Dumper\AbstractDumper;
239
- use Symfony\Component\VarDumper\Dumper\CliDumper;
237
+ use Symfony\Component\VarDumper\Dumper\AbstractDumper;
238
+ use Symfony\Component\VarDumper\Dumper\CliDumper;
240
239
241
- $var = array('test');
242
- $dumper = new CliDumper();
243
- echo $dumper->dump($var, true);
240
+ $var = array('test');
241
+ $dumper = new CliDumper();
242
+ echo $dumper->dump($var, true);
244
243
245
- // array:1 [
246
- // 0 => "test"
247
- // ]
244
+ // array:1 [
245
+ // 0 => "test"
246
+ // ]
248
247
249
- $dumper = new CliDumper(null, null, AbstractDumper::DUMP_LIGHT_ARRAY);
250
- echo $dumper->dump($var, true);
248
+ $dumper = new CliDumper(null, null, AbstractDumper::DUMP_LIGHT_ARRAY);
249
+ echo $dumper->dump($var, true);
251
250
252
- // (no more array:1 prefix)
253
- // [
254
- // 0 => "test"
255
- // ]
251
+ // (no more array:1 prefix)
252
+ // [
253
+ // 0 => "test"
254
+ // ]
256
255
257
- * If you would like to use both options, then you can just
258
- combine them by using a the logical OR operator ``| ``.
256
+ If you would like to use both options, then you can just combine them by
257
+ using a the logical OR operator ``| ``:
259
258
260
- .. code-block :: php
259
+ .. code-block :: php
261
260
262
- use Symfony\Component\VarDumper\Dumper\AbstractDumper;
263
- use Symfony\Component\VarDumper\Dumper\CliDumper;
261
+ use Symfony\Component\VarDumper\Dumper\AbstractDumper;
262
+ use Symfony\Component\VarDumper\Dumper\CliDumper;
264
263
265
- $var = array('test');
266
- $dumper = new CliDumper(null, null, AbstractDumper::DUMP_STRING_LENGTH | AbstractDumper::DUMP_LIGHT_ARRAY);
267
- echo $dumper->dump($var, true);
264
+ $var = array('test');
265
+ $dumper = new CliDumper(null, null, AbstractDumper::DUMP_STRING_LENGTH | AbstractDumper::DUMP_LIGHT_ARRAY);
266
+ echo $dumper->dump($var, true);
268
267
269
- // [
270
- // 0 => (4) "test"
271
- // ]
268
+ // [
269
+ // 0 => (4) "test"
270
+ // ]
272
271
273
272
Casters
274
273
-------
0 commit comments