original_string: public function import_hint($hintxml, $defaultformat) {
          $hint = new stdClass();
          if (array_key_exists('hintcontent', $hintxml['#'])) {
              // Backwards compatibility.
  
              $hint->hint = $this->import_text_with_files($hintxml,
                      array('#', 'hintcontent', 0), '', $defaultformat);
  
              $hint->shownumcorrect = $this->getpath($hintxml,
                      array('#', 'statenumberofcorrectresponses', 0, '#'), 0);
              $hint->clearwrong = $this->getpath($hintxml,
                      array('#', 'clearincorrectresponses', 0, '#'), 0);
              $hint->options = $this->getpath($hintxml,
                      array('#', 'showfeedbacktoresponses', 0, '#'), 0);
  
              return $hint;
          }
          $hint->hint = $this->import_text_with_files($hintxml, array(), '', $defaultformat);
          $hint->shownumcorrect = array_key_exists('shownumcorrect', $hintxml['#']);
          $hint->clearwrong = array_key_exists('clearwrong', $hintxml['#']);
          $hint->options = $this->getpath($hintxml, array('#', 'options', 0, '#'), '', true);
  
          return $hint;
      }
code: public function import_hint($hintxml, $defaultformat) {
          $hint = new stdClass();
          if (array_key_exists('hintcontent', $hintxml['#'])) {
              // Backwards compatibility.
  
              $hint->hint = $this->import_text_with_files($hintxml,
                      array('#', 'hintcontent', 0), '', $defaultformat);
  
              $hint->shownumcorrect = $this->getpath($hintxml,
                      array('#', 'statenumberofcorrectresponses', 0, '#'), 0);
              $hint->clearwrong = $this->getpath($hintxml,
                      array('#', 'clearincorrectresponses', 0, '#'), 0);
              $hint->options = $this->getpath($hintxml,
                      array('#', 'showfeedbacktoresponses', 0, '#'), 0);
  
              return $hint;
          }
          $hint->hint = $this->import_text_with_files($hintxml, array(), '', $defaultformat);
          $hint->shownumcorrect = array_key_exists('shownumcorrect', $hintxml['#']);
          $hint->clearwrong = array_key_exists('clearwrong', $hintxml['#']);
          $hint->options = $this->getpath($hintxml, array('#', 'options', 0, '#'), '', true);
  
          return $hint;
      }
code_tokens: public function import_hint ( $ hintxml , $ defaultformat ) { $ hint = new stdClass ( ) ; if ( array_key_exists ( 'hintcontent' , $ hintxml [ '#' ] ) ) { // Backwards compatibility. $ hint -> hint = $ this -> import_text_with_files ( $ hintxml , array ( '#' , 'hintcontent' , 0 ) , '' , $ defaultformat ) ; $ hint -> shownumcorrect = $ this -> getpath ( $ hintxml , array ( '#' , 'statenumberofcorrectresponses' , 0 , '#' ) , 0 ) ; $ hint -> clearwrong = $ this -> getpath ( $ hintxml , array ( '#' , 'clearincorrectresponses' , 0 , '#' ) , 0 ) ; $ hint -> options = $ this -> getpath ( $ hintxml , array ( '#' , 'showfeedbacktoresponses' , 0 , '#' ) , 0 ) ; return $ hint ; } $ hint -> hint = $ this -> import_text_with_files ( $ hintxml , array ( ) , '' , $ defaultformat ) ; $ hint -> shownumcorrect = array_key_exists ( 'shownumcorrect' , $ hintxml [ '#' ] ) ; $ hint -> clearwrong = array_key_exists ( 'clearwrong' , $ hintxml [ '#' ] ) ; $ hint -> options = $ this -> getpath ( $ hintxml , array ( '#' , 'options' , 0 , '#' ) , '' , true ) ; return $ hint ; }
docstring: Import a question hint
  @param array $hintxml hint xml fragment.
  @param string $defaultformat the text format to assume for hints that do not specify.
  @return object hint for storing in the database.
docstring_tokens: Import a question hint