From: Fabien Potencier Date: Fri, 10 Oct 2014 23:36:34 +0000 (+0200) Subject: fixed CS X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=1897e184a9fd138a54091cb769212852b4849034;p=web%2Fkonrad%2Ftwig.git fixed CS --- diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index 1668b83..a94e97c 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -798,29 +798,29 @@ function twig_join_filter($value, $glue = '') */ function twig_split_filter(Twig_Environment $env, $value, $delimiter, $limit = null) { - if (empty($delimiter)) { - if (function_exists('mb_get_info') && null !== $charset = $env->getCharset()) { - if ($limit > 1) { - $length = mb_strlen($value, $charset); - if ($length < $limit) { - return array($value); - } + if (!empty($delimiter)) { + return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit); + } - $r = array(); - for ($i = 0; $i < $length; $i += $limit) { - $r[] = mb_substr($value, $i, $limit, $charset); - } + if (!function_exists('mb_get_info') || null === $charset = $env->getCharset()) { + return str_split($value, null === $limit ? 1 : $limit); + } - return $r; - } + if ($limit <= 1) { + return preg_split('/(?