@@ -37,6 +37,51 @@ public function getRawData()
3737 return $ this ->data ;
3838 }
3939
40+ /**
41+ * Returns a depth limited clone of $this.
42+ *
43+ * @param int $maxDepth The max dumped depth level.
44+ *
45+ * @return self A clone of $this.
46+ */
47+ public function withMaxDepth ($ maxDepth )
48+ {
49+ $ data = clone $ this ;
50+ $ data ->maxDepth = (int ) $ maxDepth ;
51+
52+ return $ data ;
53+ }
54+
55+ /**
56+ * Limits the numbers of elements per depth level.
57+ *
58+ * @param int $maxItemsPerDepth The max number of items dumped per depth level.
59+ *
60+ * @return self A clone of $this.
61+ */
62+ public function withMaxItemsPerDepth ($ maxItemsPerDepth )
63+ {
64+ $ data = clone $ this ;
65+ $ data ->maxItemsPerDepth = (int ) $ maxItemsPerDepth ;
66+
67+ return $ data ;
68+ }
69+
70+ /**
71+ * Enables/disables objects' identifiers tracking.
72+ *
73+ * @param bool $useRefHandles False to hide global ref. handles.
74+ *
75+ * @return self A clone of $this.
76+ */
77+ public function withRefHandles ($ useRefHandles )
78+ {
79+ $ data = clone $ this ;
80+ $ data ->useRefHandles = $ useRefHandles ? -1 : 0 ;
81+
82+ return $ data ;
83+ }
84+
4085 /**
4186 * Returns a depth limited clone of $this.
4287 *
@@ -45,9 +90,13 @@ public function getRawData()
4590 * @param bool $useRefHandles False to hide ref. handles.
4691 *
4792 * @return self A depth limited clone of $this.
93+ *
94+ * @deprecated since Symfony 2.7, to be removed in 3.0. Use withMaxDepth, withMaxItemsPerDepth or withRefHandles instead.
4895 */
4996 public function getLimitedClone ($ maxDepth , $ maxItemsPerDepth , $ useRefHandles = true )
5097 {
98+ trigger_error ('The ' .__METHOD__ .' method is deprecated since Symfony 2.7 and will be removed in 3.0. Use withMaxDepth, withMaxItemsPerDepth or withRefHandles methods instead. ' , E_USER_DEPRECATED );
99+
51100 $ data = clone $ this ;
52101 $ data ->maxDepth = (int ) $ maxDepth ;
53102 $ data ->maxItemsPerDepth = (int ) $ maxItemsPerDepth ;
0 commit comments