Conditions | 4 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5434 | 2 | public static function single_chr_html_encode( |
|
5435 | string $char, |
||
5436 | bool $keep_ascii_chars = false, |
||
5437 | string $encoding = 'UTF-8' |
||
5438 | ): string { |
||
5439 | 2 | if ($char === '') { |
|
5440 | 2 | return ''; |
|
5441 | } |
||
5442 | |||
5443 | if ( |
||
5444 | 2 | $keep_ascii_chars |
|
5445 | && |
||
5446 | 2 | ASCII::is_ascii($char) |
|
5447 | ) { |
||
5448 | 2 | return $char; |
|
5449 | } |
||
5450 | |||
5451 | 2 | return '&#' . self::ord($char, $encoding) . ';'; |
|
5452 | } |
||
13694 |