From 0150fdf8db17be3cb77e978f3664bea4a618884f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 6 Feb 2012 09:58:57 +0100 Subject: [PATCH] fixes CS --- lib/Twig/Extension/Core.php | 12 ++---------- 1 files changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index 9c5f9c2..6225557 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -550,18 +550,10 @@ function twig_slice(Twig_Environment $env, $item, $start, $length = null) $item = (string) $item; if (function_exists('mb_get_info') && null !== $charset = $env->getCharset()) { - if (null === $length) { - $length = mb_strlen($item, $charset) - $start; - } - - return mb_substr($item, $start, $length, $charset); - } - - if (null === $length) { - return substr($item, $start); + return mb_substr($item, $start, null === $length ? mb_strlen($item, $charset) - $start : $length, $charset); } - return substr($item, $start, $length); + return null === $length ? substr($item, $start) : substr($item, $start, $length); } /** -- 1.7.2.5