/** * Walks recursivly throught an array and concatinates the found info to a string. * * @param \RecursiveIterator $iterator * * @return string */ protected static function traverseStructure($iterator) { $children = ''; while ($iterator->valid()) { if ($iterator->hasChildren()) { $current = 'array (' . self::traverseStructure($iterator->getChildren()) . '), '; } else { $current = "'" . $iterator->current() . "', "; } $key = $iterator->key(); if (is_numeric($key)) { $children .= $key . " => " . $current; } else { $children .= "'" . $key . "' => " . $current; } $iterator->next(); } return $children; }