File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -9,17 +9,22 @@ class Str {
9
9
*/
10
10
public static $ pluralizer ;
11
11
12
- /**
13
- * Get the default string encoding for the application.
14
- *
15
- * This method is simply a short-cut to Config::get('application.encoding').
16
- *
17
- * @return string
18
- */
19
- public static function encoding ()
20
- {
21
- return Config::get ('application.encoding ' );
22
- }
12
+ /**
13
+ * Cache application encoding locally to save expensive calls to Config::get().
14
+ *
15
+ * @var string
16
+ */
17
+ public static $ encoding = null ;
18
+
19
+ /**
20
+ * Get the appliction.encoding without needing to request it from Config::get() each time.
21
+ *
22
+ * @return string
23
+ */
24
+ protected static function encoding ()
25
+ {
26
+ return static ::$ encoding ?: static ::$ encoding = Config::get ('application.encoding ' );
27
+ }
23
28
24
29
/**
25
30
* Get the length of a string.
You can’t perform that action at this time.
0 commit comments