original_string: public function path_start_reached($path) {
  
          if ($path === '/MOODLE_BACKUP/COURSE/MODULES/MOD') {
              $this->currentmod = null;
              $forbidden = true;
  
          } else if (strpos($path, '/MOODLE_BACKUP/COURSE/MODULES/MOD') === 0) {
              // expand the MOD paths so that they contain the module name
              $path = str_replace('/MOODLE_BACKUP/COURSE/MODULES/MOD', '/MOODLE_BACKUP/COURSE/MODULES/MOD/' . $this->currentmod, $path);
          }
  
          if ($path === '/MOODLE_BACKUP/COURSE/BLOCKS/BLOCK') {
              $this->currentblock = null;
              $forbidden = true;
  
          } else if (strpos($path, '/MOODLE_BACKUP/COURSE/BLOCKS/BLOCK') === 0) {
              // expand the BLOCK paths so that they contain the module name
              $path = str_replace('/MOODLE_BACKUP/COURSE/BLOCKS/BLOCK', '/MOODLE_BACKUP/COURSE/BLOCKS/BLOCK/' . $this->currentblock, $path);
          }
  
          if (empty($this->pathelements[$path])) {
              return;
          }
  
          $element = $this->pathelements[$path];
          $pobject = $element->get_processing_object();
          $method  = $element->get_start_method();
  
          if (method_exists($pobject, $method)) {
              if (empty($forbidden)) {
                  $pobject->$method();
  
              } else {
                  // this path is not supported because we do not know the module/block yet
                  throw new coding_exception('Attaching the on-start event listener to the root MOD or BLOCK element is forbidden.');
              }
          }
      }
code: public function path_start_reached($path) {
  
          if ($path === '/MOODLE_BACKUP/COURSE/MODULES/MOD') {
              $this->currentmod = null;
              $forbidden = true;
  
          } else if (strpos($path, '/MOODLE_BACKUP/COURSE/MODULES/MOD') === 0) {
              // expand the MOD paths so that they contain the module name
              $path = str_replace('/MOODLE_BACKUP/COURSE/MODULES/MOD', '/MOODLE_BACKUP/COURSE/MODULES/MOD/' . $this->currentmod, $path);
          }
  
          if ($path === '/MOODLE_BACKUP/COURSE/BLOCKS/BLOCK') {
              $this->currentblock = null;
              $forbidden = true;
  
          } else if (strpos($path, '/MOODLE_BACKUP/COURSE/BLOCKS/BLOCK') === 0) {
              // expand the BLOCK paths so that they contain the module name
              $path = str_replace('/MOODLE_BACKUP/COURSE/BLOCKS/BLOCK', '/MOODLE_BACKUP/COURSE/BLOCKS/BLOCK/' . $this->currentblock, $path);
          }
  
          if (empty($this->pathelements[$path])) {
              return;
          }
  
          $element = $this->pathelements[$path];
          $pobject = $element->get_processing_object();
          $method  = $element->get_start_method();
  
          if (method_exists($pobject, $method)) {
              if (empty($forbidden)) {
                  $pobject->$method();
  
              } else {
                  // this path is not supported because we do not know the module/block yet
                  throw new coding_exception('Attaching the on-start event listener to the root MOD or BLOCK element is forbidden.');
              }
          }
      }
code_tokens: public function path_start_reached ( $ path ) { if ( $ path === '/MOODLE_BACKUP/COURSE/MODULES/MOD' ) { $ this -> currentmod = null ; $ forbidden = true ; } else if ( strpos ( $ path , '/MOODLE_BACKUP/COURSE/MODULES/MOD' ) === 0 ) { // expand the MOD paths so that they contain the module name $ path = str_replace ( '/MOODLE_BACKUP/COURSE/MODULES/MOD' , '/MOODLE_BACKUP/COURSE/MODULES/MOD/' . $ this -> currentmod , $ path ) ; } if ( $ path === '/MOODLE_BACKUP/COURSE/BLOCKS/BLOCK' ) { $ this -> currentblock = null ; $ forbidden = true ; } else if ( strpos ( $ path , '/MOODLE_BACKUP/COURSE/BLOCKS/BLOCK' ) === 0 ) { // expand the BLOCK paths so that they contain the module name $ path = str_replace ( '/MOODLE_BACKUP/COURSE/BLOCKS/BLOCK' , '/MOODLE_BACKUP/COURSE/BLOCKS/BLOCK/' . $ this -> currentblock , $ path ) ; } if ( empty ( $ this -> pathelements [ $ path ] ) ) { return ; } $ element = $ this -> pathelements [ $ path ] ; $ pobject = $ element -> get_processing_object ( ) ; $ method = $ element -> get_start_method ( ) ; if ( method_exists ( $ pobject , $ method ) ) { if ( empty ( $ forbidden ) ) { $ pobject -> $ method ( ) ; } else { // this path is not supported because we do not know the module/block yet throw new coding_exception ( 'Attaching the on-start event listener to the root MOD or BLOCK element is forbidden.' ) ; } } }
docstring: Executes operations required at the start of a watched path
  
  For MOD and BLOCK paths, this is supported only for the sub-paths, not the root
  module/block element. For the illustration:
  
  You CAN'T attach on_xxx_start() listener to a path like
  /MOODLE_BACKUP/COURSE/MODULES/MOD/WORKSHOP because the <MOD> must
  be processed first in {@link self::process_chunk()} where $this->currentmod
  is set.
  
  You CAN attach some on_xxx_start() listener to a path like
  /MOODLE_BACKUP/COURSE/MODULES/MOD/WORKSHOP/SUBMISSIONS because it is
  a sub-path under <MOD> and we have $this->currentmod already set when the
  <SUBMISSIONS> is reached.
  
  @param string $path in the original file
docstring_tokens: Executes operations required at the start of a watched path