Conditions | 1 |
Paths | 1 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
40 | public function getWordsAttribute() |
||
41 | { |
||
42 | $text = $this->text; |
||
43 | |||
44 | $text = preg_replace('/```.*?```/su', '', $text); |
||
45 | $text = preg_replace('/`.*?`/su', '', $text); |
||
46 | $text = preg_replace(UrlFinder::getPattern(), '', $text); |
||
47 | $text = preg_replace('/@[a-z0-9_@]+/iu', '', $text); |
||
48 | |||
49 | preg_match_all('/\w+/iu', $text, $words, PREG_PATTERN_ORDER); |
||
50 | |||
51 | return array_map(function ($word) { |
||
52 | return mb_strtolower($word); |
||
53 | }, $words[0]); |
||
54 | } |
||
55 | } |
||
56 |