Name::camelize()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 2.0017

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 12
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 18
ccs 12
cts 13
cp 0.9231
crap 2.0017
rs 9.8666
1
<?php
2
3
declare(strict_types=1);
4
5
namespace drupol\ComposerPackages\Utils;
6
7
final class Name
8
{
9 5
    public static function camelize(string $str): string
10
    {
11 5
        $str = preg_replace(
12 5
            '/[^a-z0-9]+/i',
13 5
            ' ',
14 5
            $str
15
        );
16
17 5
        if (null === $str) {
18
            return '';
19
        }
20
21 5
        return lcfirst(
22 5
            str_replace(
23 5
                ' ',
24 5
                '',
25 5
                ucwords(
26 5
                    $str
27
                )
28
            )
29
        );
30
    }
31
}
32