Skip to content

Commit e7a7faa

Browse files
committed
some refactoring
1 parent e6e567d commit e7a7faa

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

classes/snippets.php

+13-10
Original file line numberDiff line numberDiff line change
@@ -53,32 +53,35 @@ class snippets {
5353
* @param mixed $domain
5454
* @return string|null
5555
*/
56-
public static function get_snippet_file($key, $source, $domain = '') {
56+
public static function get_snippet_file($key, $source, $domain) {
5757
global $CFG;
5858
if ('theme_boost_union' === $source) {
5959
$file = $CFG->dirroot . sprintf('/theme/boost_union/snippets/builtin/%s.scss', $key);
6060
} else {
61+
// TODO: other sources.
6162
return null;
6263
}
64+
6365
return is_readable($file) ? $file : null;
6466
}
6567

6668
/**
67-
* TODO
69+
* Loads the Snippets SCSS content.
70+
*
6871
* @param mixed $key
6972
* @param mixed $source
7073
* @param mixed $domain
71-
* @return bool|string
74+
* @return boolean|string
7275
*/
73-
public static function get_snippet_css($key, $source, $domain = '') {
74-
// Get the snippets file, based on the source and domain.s
75-
$file = self::get_snippet_file($key, $source);
76+
public static function get_snippet_scss($key, $source, $domain = '') {
77+
// Get the snippets file, based on the source and domain.
78+
$file = self::get_snippet_file($key, $source, $domain);
7679

7780
if (is_null($file)) {
78-
return;
81+
return null;
7982
}
80-
$scss = file_get_contents( $file, false, null, 0);
8183

84+
$scss = file_get_contents( $file, false, null, 0);
8285
return $scss;
8386
}
8487

@@ -88,11 +91,11 @@ public static function get_snippet_css($key, $source, $domain = '') {
8891
* @param string $domain
8992
* @return mixed
9093
*/
91-
public static function get_snippet_meta($key, $source) {
94+
public static function get_snippet_meta($key, $source, $domain = '') {
9295
global $CFG;
9396

9497
// Get the snippets file, based on the source and domain.
95-
$file = self::get_snippet_file($key, $source);
98+
$file = self::get_snippet_file($key, $source, $domain);
9699

97100
if (is_null($file)) {
98101
return;

0 commit comments

Comments
 (0)