Commit 09500818 authored by Taylor Otwell's avatar Taylor Otwell

Merge pull request #1204 from bryantebeek/optimisation/str-class

Performance enhancement for Str Class (see pull request #1180)
parents fc9b0e16 01ba3557
...@@ -10,15 +10,20 @@ class Str { ...@@ -10,15 +10,20 @@ class Str {
public static $pluralizer; public static $pluralizer;
/** /**
* Get the default string encoding for the application. * Cache application encoding locally to save expensive calls to Config::get().
* *
* This method is simply a short-cut to Config::get('application.encoding'). * @var string
*/
public static $encoding = null;
/**
* Get the appliction.encoding without needing to request it from Config::get() each time.
* *
* @return string * @return string
*/ */
public static function encoding() protected static function encoding()
{ {
return Config::get('application.encoding'); return static::$encoding ?: static::$encoding = Config::get('application.encoding');
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment