Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4.0119 |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
51 | 7 | public function filter($value) |
|
52 | { |
||
53 | 7 | if (empty($value) && isset($this->filterData[$this->fieldToSlugFrom])) { |
|
54 | 1 | $value = $this->filterData[$this->fieldToSlugFrom]; |
|
55 | 1 | } |
|
56 | |||
57 | 7 | if (is_null($value)) { |
|
58 | return; |
||
59 | } |
||
60 | |||
61 | 7 | $value = transliterator_transliterate($this->transliterator, $value); |
|
62 | 7 | $value = iconv("UTF-8", "ASCII//TRANSLIT//IGNORE", $value); |
|
63 | 7 | $value = preg_replace('/[-$?\s]+/', '-', $value); |
|
64 | 7 | $value = trim($value, '-'); |
|
65 | 7 | return strtolower($value); |
|
66 | } |
||
67 | } |
||
68 |