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

InflectionClassifyTrait::doClassify()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 7
ccs 4
cts 4
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 InflectionClassifyTrait
7
 * @package Nip\Inflector\Traits
8
 *
9
 * @method classify($string)
10
 */
11
trait InflectionClassifyTrait
12
{
13
14
    /**
15
     * Converts lowercase string to underscored camelize class format
16
     *
17
     * @param string $string
18
     * @return string
19
     */
20 6
    protected function doClassify($string)
21
    {
22 6
        $parts = explode("-", $string);
23 6
        $parts = array_map([$this, "camelize"], $parts);
24
25 6
        return implode("_", $parts);
26
    }
27
}
28