@@ -10,22 +10,27 @@ Cloners
10
10
11
11
A cloner is used to create an intermediate representation of any PHP variable.
12
12
Its output is a :class: `Symfony\\ Component\\ VarDumper\\ Cloner\\ Data `
13
- object that wraps this representation. A cloner also applies limits when
14
- creating the representation, so that the corresponding Data object could
15
- represent only a subset of the cloned variable.
13
+ object that wraps this representation.
16
14
17
15
You can create a :class: `Symfony\\ Component\\ VarDumper\\ Cloner\\ Data `
18
16
object this way::
19
17
20
18
$cloner = new VarCloner();
21
19
$data = $cloner->cloneVar($myVar);
22
20
23
- Before cloning, you can configure the limits with::
21
+ A cloner also applies limits when creating this representation, so that the
22
+ corresponding Data object could represent only a subset of the cloned variable.
23
+ Before :method: `Symfony\\ Component\\ VarDumper\\ Cloner\\ VarCloner::cloneVar `,
24
+ you can configure these limits:
24
25
25
- $cloner->setMaxItems($number);
26
- $cloner->setMaxString($number);
27
-
28
- They will be applied when calling ``->cloneVar() `` afterwards.
26
+ * :method: `Symfony\\ Component\\ VarDumper\\ Cloner\\ VarCloner::setMaxItems `
27
+ configures the maximum number of items that will be cloned *past the first
28
+ nesting level *. Items are counted using a breadth-first algorithm so that
29
+ lower level items have higher priority than deeply nested items;
30
+ * :method: `Symfony\\ Component\\ VarDumper\\ Cloner\\ VarCloner::setMaxString `
31
+ configures the maximum number of characters that will be cloned before
32
+ cutting overlong strings;
33
+ * in both cases, specifying `-1 ` removes any limit.
29
34
30
35
Before dumping it, you can further limit the resulting
31
36
:class: `Symfony\\ Component\\ VarDumper\\ Cloner\\ Data ` object by calling its
@@ -34,16 +39,16 @@ method:
34
39
35
40
* the first ``$maxDepth `` argument allows limiting dumps in the depth dimension,
36
41
* the second ``$maxItemsPerDepth `` limits the number of items per depth level,
37
- * and the last ``$useRefHandles `` defaults to ``true `` but allows removing internal
38
- objects' handles for sparser output,
39
- * but unlike the previous limits on cloners that remove data on purpose, these
40
- limits can be changed back and forth before dumping since they do not affect
42
+ * and the last ``$useRefHandles `` defaults to ``true `` but allows removing
43
+ internal objects' handles for sparser output,
44
+ * but unlike the previous limits on cloners that remove data on purpose,
45
+ these can be changed back and forth before dumping since they do not affect
41
46
the intermediate representation internally.
42
47
43
48
.. note ::
44
49
When no limit is applied, a :class: `Symfony\\ Component\\ VarDumper\\ Cloner\\ Data `
45
- object is as accurate as the native :phpfunction: `serialize ` function and thus
46
- could have a wider purpose than strictly dumping for debugging.
50
+ object is as accurate as the native :phpfunction: `serialize ` function
51
+ and thus could have a wider purpose than strictly dumping for debugging.
47
52
48
53
Dumpers
49
54
~~~~~~~
0 commit comments