Passed
Push — master ( 03087a...f49b8e )
by Gabriel
01:58
created

InflectionUnclasifyTrait::doUnclassify()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 8
ccs 5
cts 5
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
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 6
    protected function doUnclassify($string)
21
    {
22 6
        $string = str_replace('\\', '_', $string);
23 6
        $parts = explode("_", $string);
24 6
        $parts = array_map([$this, "underscore"], $parts);
25
26 6
        return implode("-", $parts);
27
    }
28
}
29