Commit 01ba3557 authored by Bryan te Beek's avatar Bryan te Beek

Optimize Str-helper (see pull request #1180)

Signed-off-by: 's avatarBryan te Beek <bryantebeek@gmail.com>
parent 1f005bd7
...@@ -9,17 +9,22 @@ class Str { ...@@ -9,17 +9,22 @@ 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
* */
* @return string public static $encoding = null;
*/
public static function encoding() /**
{ * Get the appliction.encoding without needing to request it from Config::get() each time.
return Config::get('application.encoding'); *
} * @return string
*/
protected static function encoding()
{
return static::$encoding ?: static::$encoding = Config::get('application.encoding');
}
/** /**
* Get the length of a string. * Get the length of a string.
......
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