InflectionUnclasifyTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 16
ccs 5
cts 5
cp 1
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A doUnclassify() 0 7 1
1
<?php
2
3
namespace Nip\Inflector\Traits;
4
5
/**
6
 * Trait InflectionUnclasifyTrait
7
 * @package Nip\Inflector\Traits
8
 *
9
 * @method unclassify($string)
10
 */
11
trait InflectionUnclasifyTrait
12
{
13
14
    /**
15
     * Reverses classify()
16
     *
17
     * @param string $string
18
     * @return string
19
     */
20 7
    protected function doUnclassify($string)
21
    {
22 7
        $string = str_replace('\\', '_', $string);
23 7
        $parts = explode("_", $string);
24 7
        $parts = array_map([$this, "underscore"], $parts);
25
26 7
        return implode("-", $parts);
27
    }
28
}
29