| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 49 | public function limitWords($text, $limitWords = 50, $suffix = '...') |
||
| 50 | { |
||
| 51 | $textArray = explode(' ', $text); |
||
| 52 | $count = count($textArray); |
||
| 53 | if ($count > $limitWords) { |
||
| 54 | $result = array_slice($textArray, 0, $limitWords); |
||
| 55 | $text = implode(' ', $result) . $suffix; |
||
| 56 | } |
||
| 57 | return $text; |
||
| 58 | } |
||
| 59 | } |