original_string: protected static function export_posts_in_structure(int $userid, \context $context, $parentarea, \stdClass $structure) {
          foreach ($structure->children as $post) {
              if (!$post->hasdata) {
                  // This tree has no content belonging to the user. Skip it and all children.
                  continue;
              }
  
              $postarea = array_merge($parentarea, static::get_post_area($post));
  
              // Store the post content.
              static::export_post_data($userid, $context, $postarea, $post);
  
              if (isset($post->children)) {
                  // Now export children of this post.
                  static::export_posts_in_structure($userid, $context, $postarea, $post);
              }
          }
      }
code: protected static function export_posts_in_structure(int $userid, \context $context, $parentarea, \stdClass $structure) {
          foreach ($structure->children as $post) {
              if (!$post->hasdata) {
                  // This tree has no content belonging to the user. Skip it and all children.
                  continue;
              }
  
              $postarea = array_merge($parentarea, static::get_post_area($post));
  
              // Store the post content.
              static::export_post_data($userid, $context, $postarea, $post);
  
              if (isset($post->children)) {
                  // Now export children of this post.
                  static::export_posts_in_structure($userid, $context, $postarea, $post);
              }
          }
      }
code_tokens: protected static function export_posts_in_structure ( int $ userid , \ context $ context , $ parentarea , \ stdClass $ structure ) { foreach ( $ structure -> children as $ post ) { if ( ! $ post -> hasdata ) { // This tree has no content belonging to the user. Skip it and all children. continue ; } $ postarea = array_merge ( $ parentarea , static :: get_post_area ( $ post ) ) ; // Store the post content. static :: export_post_data ( $ userid , $ context , $ postarea , $ post ) ; if ( isset ( $ post -> children ) ) { // Now export children of this post. static :: export_posts_in_structure ( $ userid , $ context , $ postarea , $ post ) ; } } }
docstring: Export all posts in the provided structure.
  
  @param   int         $userid The userid of the user whose data is to be exported.
  @param   \context    $context The instance of the forum context.
  @param   array       $parentarea The subcontext of the parent.
  @param   \stdClass   $structure The post structure and all of its children
docstring_tokens: Export all posts in the provided structure .