original_string: protected static function set_xpath($xpath, $parameters, $prefix = '') {
          foreach ($parameters as $key => $value) {
              if (is_array($value)) {
                  self::set_xpath($xpath, $value, $prefix . $key);
              } else {
                  $result = @$xpath->query($prefix . $key);
                  if ($result) {
                      $node = $result->item(0);
                      if ($node) {
                          if (is_null($value)) {
                              $node->parentNode->removeChild($node);
                          } else {
                              $node->nodeValue = $value;
                          }
                      }
                  } else {
                      throw new \coding_exception('Please check your XPATH and try again.');
                  }
              }
          }
      }
code: protected static function set_xpath($xpath, $parameters, $prefix = '') {
          foreach ($parameters as $key => $value) {
              if (is_array($value)) {
                  self::set_xpath($xpath, $value, $prefix . $key);
              } else {
                  $result = @$xpath->query($prefix . $key);
                  if ($result) {
                      $node = $result->item(0);
                      if ($node) {
                          if (is_null($value)) {
                              $node->parentNode->removeChild($node);
                          } else {
                              $node->nodeValue = $value;
                          }
                      }
                  } else {
                      throw new \coding_exception('Please check your XPATH and try again.');
                  }
              }
          }
      }
code_tokens: protected static function set_xpath ( $ xpath , $ parameters , $ prefix = '' ) { foreach ( $ parameters as $ key => $ value ) { if ( is_array ( $ value ) ) { self :: set_xpath ( $ xpath , $ value , $ prefix . $ key ) ; } else { $ result = @ $ xpath -> query ( $ prefix . $ key ) ; if ( $ result ) { $ node = $ result -> item ( 0 ) ; if ( $ node ) { if ( is_null ( $ value ) ) { $ node -> parentNode -> removeChild ( $ node ) ; } else { $ node -> nodeValue = $ value ; } } } else { throw new \ coding_exception ( 'Please check your XPATH and try again.' ) ; } } } }
docstring: Traverses a recursive associative array, setting the properties of the corresponding
  xpath element.
  
  @param \DOMXPath $xpath The xpath with the xml to modify
  @param array $parameters The array of xpaths to search through
  @param string $prefix The current xpath prefix (gets longer the deeper into the array you go)
  @return void
  @since Moodle 3.2
docstring_tokens: Traverses a recursive associative array setting the properties of the corresponding xpath element .