original_string: public function patch(ExerciseInterface $exercise, $code)
      {
          if (null !== $this->defaultPatch) {
              $code = $this->applyPatch($this->defaultPatch, $code);
          }
  
          if ($exercise instanceof SubmissionPatchable) {
              $code = $this->applyPatch($exercise->getPatch(), $code);
          }
          
          return $code;
      }
code: public function patch(ExerciseInterface $exercise, $code)
      {
          if (null !== $this->defaultPatch) {
              $code = $this->applyPatch($this->defaultPatch, $code);
          }
  
          if ($exercise instanceof SubmissionPatchable) {
              $code = $this->applyPatch($exercise->getPatch(), $code);
          }
          
          return $code;
      }
code_tokens: public function patch ( ExerciseInterface $ exercise , $ code ) { if ( null !== $ this -> defaultPatch ) { $ code = $ this -> applyPatch ( $ this -> defaultPatch , $ code ) ; } if ( $ exercise instanceof SubmissionPatchable ) { $ code = $ this -> applyPatch ( $ exercise -> getPatch ( ) , $ code ) ; } return $ code ; }
docstring: Accepts an exercise and a string containing the students solution to the exercise.
  
  If there is a default patch, the students solution is patched with that.
  
  If the exercise implements `SubmissionPatchable` then the patch is pulled from it and applied to
  the students solution.
  
  @param ExerciseInterface $exercise
  @param string $code
  @return string
docstring_tokens: Accepts an exercise and a string containing the students solution to the exercise .