Conditions | 4 |
Paths | 5 |
Total Lines | 18 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 4 | ||
Bugs | 2 | Features | 0 |
1 | <?php |
||
9194 | 4 | public static function string($intOrHex): string |
|
9195 | { |
||
9196 | 4 | if ($intOrHex === []) { |
|
9197 | 4 | return ''; |
|
9198 | } |
||
9199 | |||
9200 | 4 | if (!\is_array($intOrHex)) { |
|
9201 | 1 | $intOrHex = [$intOrHex]; |
|
9202 | } |
||
9203 | |||
9204 | 4 | $str = ''; |
|
9205 | 4 | foreach ($intOrHex as $strPart) { |
|
9206 | 4 | $str .= '&#' . (int) $strPart . ';'; |
|
9207 | } |
||
9208 | |||
9209 | // We cannot use html_entity_decode() here, as it will not return |
||
9210 | // characters for many values < 160. |
||
9211 | 4 | return mb_convert_encoding($str, 'UTF-8', 'HTML-ENTITIES'); |
|
9212 | } |
||
13689 |