@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @retval 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 |
@@ -108,7 +108,7 @@ |
||
108 | 108 | * @param[in] integer $offset The offset to retrieve. |
109 | 109 | * @retval mixed Can return all value types. |
110 | 110 | */ |
111 | - public function offsetGet($offset) { |
|
111 | + public function offsetGet($offset) { |
|
112 | 112 | return $this->meta[$this->name][$offset]; |
113 | 113 | } |
114 | 114 |