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

InflectionUnclasifyTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A doUnclassify() 0 8 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 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