@@ -44,10 +44,11 @@ |
||
| 44 | 44 | * @return string The namespace's root. |
| 45 | 45 | */ |
| 46 | 46 | public static function getClassRoot($namespace) { |
| 47 | - if (preg_match('/^(.*[\\\\])/', $namespace, $matches)) |
|
| 48 | - return $matches[0]; |
|
| 49 | - else |
|
| 50 | - return ""; |
|
| 47 | + if (preg_match('/^(.*[\\\\])/', $namespace, $matches)) { |
|
| 48 | + return $matches[0]; |
|
| 49 | + } else { |
|
| 50 | + return ""; |
|
| 51 | + } |
|
| 51 | 52 | } |
| 52 | 53 | |
| 53 | 54 | } |
| 54 | 55 | \ No newline at end of file |
@@ -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 | |