@@ -155,7 +155,7 @@ |
||
155 | 155 | // An array with the used keys. |
156 | 156 | $keys = []; |
157 | 157 | |
158 | - foreach($array as $value) { |
|
158 | + foreach ($array as $value) { |
|
159 | 159 | |
160 | 160 | if (!in_array($value[$key], $keys)) { |
161 | 161 | $keys[$i] = $value[$key]; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @return string |
64 | 64 | * @warning This function works with UTF-8 strings. |
65 | 65 | */ |
66 | - public static function truncate($text, $length = 200, $etc = ' ...', $charset='UTF-8', $breakWords = FALSE, $middle = FALSE) { |
|
66 | + public static function truncate($text, $length = 200, $etc = ' ...', $charset = 'UTF-8', $breakWords = FALSE, $middle = FALSE) { |
|
67 | 67 | if ($length == 0) |
68 | 68 | return ''; |
69 | 69 | |
@@ -71,12 +71,12 @@ discard block |
||
71 | 71 | $length -= min($length, mb_strlen($etc, $charset)); |
72 | 72 | |
73 | 73 | if (!$breakWords && !$middle) |
74 | - $text = preg_replace('/\s+?(\S+)?$/u', '', mb_substr($text, 0, $length+1, $charset)); |
|
74 | + $text = preg_replace('/\s+?(\S+)?$/u', '', mb_substr($text, 0, $length + 1, $charset)); |
|
75 | 75 | |
76 | - if(!$middle) |
|
77 | - return mb_substr($text, 0, $length, $charset) . $etc; |
|
76 | + if (!$middle) |
|
77 | + return mb_substr($text, 0, $length, $charset).$etc; |
|
78 | 78 | else |
79 | - return mb_substr($text, 0, $length/2, $charset) . $etc . mb_substr($text, -$length/2, (mb_strlen($text, $charset) - $length/2), $charset); |
|
79 | + return mb_substr($text, 0, $length / 2, $charset).$etc.mb_substr($text, -$length / 2, (mb_strlen($text, $charset) - $length / 2), $charset); |
|
80 | 80 | } |
81 | 81 | else |
82 | 82 | return $text; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @warning This function works with UTF-8 strings. |
92 | 92 | */ |
93 | 93 | public static function capitalize($text, $charset = 'UTF-8') { |
94 | - return mb_strtoupper(mb_substr($text, 0, 1, $charset), $charset) . mb_strtolower(mb_substr($text, 1, mb_strlen($text, $charset), $charset), $charset); |
|
94 | + return mb_strtoupper(mb_substr($text, 0, 1, $charset), $charset).mb_strtolower(mb_substr($text, 1, mb_strlen($text, $charset), $charset), $charset); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 |