@@ -119,101 +119,4 @@ public function dump($value)
119119 '</div> ' ,
120120 ]);
121121 }
122-
123- /**
124- * Recursively goes through an array and makes neat HTML out of it.
125- *
126- * @param mixed $values Array to make pretty.
127- * @param int $openDepth Depth to add open class
128- * @param int $currentDepth current depth.
129- * @param bool $doubleEncode Whether or not to double encode.
130- * @param \SplObjectStorage $currentAncestors Object references found down
131- * the path.
132- * @return string
133- * @deprecated 4.4.0 Use ToolbarHelper::dump() instead.
134- */
135- public function makeNeatArray (
136- $ values ,
137- $ openDepth = 0 ,
138- $ currentDepth = 0 ,
139- $ doubleEncode = false ,
140- ?\SplObjectStorage $ currentAncestors = null
141- ) {
142- if ($ currentAncestors === null ) {
143- $ ancestors = new \SplObjectStorage ();
144- } elseif (is_object ($ values )) {
145- $ ancestors = new \SplObjectStorage ();
146- $ ancestors ->addAll ($ currentAncestors );
147- $ ancestors ->attach ($ values );
148- } else {
149- $ ancestors = $ currentAncestors ;
150- }
151- $ className = "neat-array depth- $ currentDepth " ;
152- if ($ openDepth > $ currentDepth ) {
153- $ className .= ' expanded ' ;
154- }
155- $ nextDepth = $ currentDepth + 1 ;
156- $ out = "<ul class= \"$ className \"> " ;
157- if (!is_array ($ values )) {
158- if (is_bool ($ values )) {
159- $ values = [$ values ];
160- }
161- if ($ values === null ) {
162- $ values = [null ];
163- }
164- if (is_object ($ values ) && method_exists ($ values , 'toArray ' )) {
165- $ values = $ values ->toArray ();
166- }
167- }
168- if (empty ($ values )) {
169- $ values [] = '(empty) ' ;
170- }
171- if ($ this ->sort && is_array ($ values ) && $ currentDepth === 0 ) {
172- ksort ($ values );
173- }
174- foreach ($ values as $ key => $ value ) {
175- $ out .= '<li><strong> ' . h ($ key , $ doubleEncode ) . '</strong> ' ;
176- if (is_array ($ value ) && count ($ value ) > 0 ) {
177- $ out .= '(array) ' ;
178- } elseif (is_object ($ value )) {
179- $ out .= '( ' . (get_class ($ value ) ?: 'object ' ) . ') ' ;
180- }
181- if ($ value === null ) {
182- $ value = '(null) ' ;
183- }
184- if ($ value === false ) {
185- $ value = '(false) ' ;
186- }
187- if ($ value === true ) {
188- $ value = '(true) ' ;
189- }
190- if (empty ($ value ) && $ value != 0 ) {
191- $ value = '(empty) ' ;
192- }
193- if ($ value instanceof Closure) {
194- $ value = 'function ' ;
195- }
196-
197- if (is_object ($ value ) && $ ancestors ->contains ($ value )) {
198- $ value = ' - recursion ' ;
199- }
200-
201- if (
202- (
203- $ value instanceof ArrayAccess ||
204- $ value instanceof Iterator ||
205- is_array ($ value ) ||
206- is_object ($ value )
207- ) && !empty ($ value )
208- ) {
209- $ out .= $ this ->makeNeatArray ($ value , $ openDepth , $ nextDepth , $ doubleEncode , $ ancestors );
210- } else {
211- $ out .= h ($ value , $ doubleEncode );
212- }
213- $ out .= '</li> ' ;
214- }
215- $ out .= '</ul> ' ;
216-
217- return $ out ;
218- }
219122}
0 commit comments