Completed
Push — master ( a77f5f...adbff9 )
by Felix
05:04
created

Str::clean()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.6666
cc 1
eloc 6
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Felix\Scraper;
4
5
class Str
6
{
7
    /**
8
     * Limpiar la cadena y almacenar.
9
     *
10
     * @param $str string Cadena de caracteres a limpiar.
11
     * @return string
12
     */
13 1
    public static function clean($str)
14
    {
15 1
        $str = html_entity_decode($str);
16 1
        $str = str_replace("\xc2\xa0", "", $str);
17 1
        $str = trim($str);
18 1
        $str = preg_replace("!\s+!", " ", $str);
19
        
20 1
        return $str;
21
    }
22
}
23