Completed
Push — develop ( 9f1019...8cff1c )
by Greg
01:53
created

String.php ➔ mb_normalise()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
1
<?php
2
3
namespace App\Lib;
4
5
function mb_normalise($string)
6
{
7
    $string = html_entity_decode(
8
        preg_replace(
9
            '~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|tilde|uml);~i',
10
            '$1',
11
            htmlentities($string)
12
        ),
13
        ENT_QUOTES,
14
        'UTF-8'
15
    );
16
    return preg_replace('/[^A-z0-9]/', '_', mb_strtolower($string));
17
}
18