Conditions | 1 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 3 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 1 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | 1 | public static function sanitize_an( $string, $length ) { |
|
30 | /** |
||
31 | * Remove HTML tags. |
||
32 | * |
||
33 | * @link https://stackoverflow.com/questions/5732758/detect-html-tags-in-a-string |
||
34 | */ |
||
35 | |||
36 | // phpcs:ignore WordPress.WP.AlternativeFunctions.strip_tags_strip_tags -- We don't want the `trim` in `wp_strip_all_tags`. |
||
37 | 1 | $sanitized = \strip_tags( $string ); |
|
38 | |||
39 | 1 | $sanitized = \mb_substr( $sanitized, 0, $length ); |
|
40 | |||
41 | 1 | return $sanitized; |
|
42 | } |
||
44 |