Skip to content

Commit d5bbdee

Browse files
committed
Review changes
1 parent 3915701 commit d5bbdee

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

classes/snippets.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public static function get_snippet_file($path, $source): string|null {
107107
public static function get_builtin_snippet_preview_url($path, $source) {
108108
global $CFG;
109109

110-
// Replace the .scss suffix with a .png suffix in the path.
110+
// Search for the .scss suffix in the path.
111111
$search = '.scss';
112112
$pos = strrpos($path, $search);
113113
if ($pos !== false) {
@@ -127,10 +127,12 @@ public static function get_builtin_snippet_preview_url($path, $source) {
127127
$file = $files[0];
128128
// Compose the files URL.
129129
$url = new \moodle_url(substr($file, strlen($CFG->dirroot)));
130+
// And check if the file is readable.
130131
return is_readable($file) ? $url : null;
131132
}
132133
}
133-
// If anything wen't wrong return null, just as if no snippet preview is present.
134+
135+
// If anything went wrong, return null just as if no snippet preview is present.
134136
return null;
135137
}
136138

0 commit comments

Comments
 (0)