Completed
Push — develop ( 957723...53a684 )
by Greg
01:54
created

StringNormalizeTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A stringNormalise() 0 13 1
1
<?php
2
3
namespace App\Console\Commands\Traits;
4
5
trait StringNormalizeTrait
6
{
7
    public static function stringNormalise($string)
8
    {
9
        $string = html_entity_decode(
10
            preg_replace(
11
                '~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|tilde|uml);~i',
12
                '$1',
13
                htmlentities($string)
14
            ),
15
            ENT_QUOTES,
16
            'UTF-8'
17
        );
18
        return preg_replace('/[^A-z0-9]/', '_', mb_strtolower($string));
19
    }
20
}
21