Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

(no description)

Copyright: 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 326 lines (12 kb)
Included or required:0 times
Referenced: 6 times
Includes or requires: 0 files

Defines 1 class

grouped_parser_processor:: (11 methods):
  __construct()
  add_path()
  before_path()
  after_path()
  postprocess_chunk()
  path_is_grouped()
  grouped_parent_exists()
  get_parent_path()
  grouped_child_exists()
  build_currentdata()
  add_missing_sub()


Class: grouped_parser_processor  - X-Ref

Abstract xml parser processor able to group chunks as configured
and dispatch them to other arbitrary methods

This @progressive_parser_processor handles the requested paths,
allowing to group information under any of them, dispatching them
to the methods specified

Note memory increases as you group more and more paths, so use it for
well-known structures being smaller enough (never to group MBs into one
in-memory structure)

TODO: Complete phpdocs
__construct(array $paths = array()   X-Ref
Remaining space for parent directory paths.


add_path($path, $grouped = false)   X-Ref
No description

before_path($path)   X-Ref
The parser fires this each time one path is going to be parsed

param: string $path xml path which parsing has started

after_path($path)   X-Ref
The parser fires this each time one path has been parsed

param: string $path xml path which parsing has ended

postprocess_chunk($data)   X-Ref
Override this method so grouping will be happening here
also deciding between accumulating/dispatching


path_is_grouped($path)   X-Ref
No description

grouped_parent_exists($path)   X-Ref
Function that will look for any grouped
parent for the given path, returning it if found,
false if not


get_parent_path($path)   X-Ref
Get the parent path using a local cache for performance.

return: string The parent pathname.
param: $path string The pathname you wish to obtain the parent name for.

grouped_child_exists($path)   X-Ref
Function that will look for any grouped
child for the given path, returning it if found,
false if not


build_currentdata($grouped, $data)   X-Ref
This function will accumulate the chunk into the specified
grouped element for later dispatching once it is complete


add_missing_sub($grouped, $path, $tags)   X-Ref
Add non-existing subarray elements