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;
    }
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;
    }
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 ; }
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
Accepts an exercise and a string containing the students solution to the exercise .