InflectionUnclasifyTrait::doUnclassify()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 1
rs 10
c 1
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 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