Inflector::camelize()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
c 2
b 0
f 0
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Guillermoandrae\DynamoDb\Helper;
4
5
/**
6
 * Inflector class.
7
 *
8
 * @author Guillermo A. Fisher <[email protected]>
9
 */
10
final class Inflector
11
{
12
    /**
13
     * Returns a camel-cased string.
14
     *
15
     * @param string $input The input string.
16
     * @return string The camel-cased string.
17
     */
18 37
    public static function camelize(string $input): string
19
    {
20 37
        $output = '';
21 37
        $segments = explode('-', $input);
22 37
        foreach ($segments as $segment) {
23 37
            $output .= ucfirst(strtolower($segment));
24
        }
25 37
        return $output;
26
    }
27
}
28