Completed
Pull Request — master (#435)
by Anton
04:39
created

Str::toCamelCase()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Bluz Framework Component
4
 *
5
 * @copyright Bluz PHP Team
6
 * @link      https://github.com/bluzphp/framework
7
 */
8
9
declare(strict_types=1);
10
11
namespace Bluz\Common;
12
13
/**
14
 * Line is string :)
15
 *
16
 * @package  Bluz\Common
17
 * @author   Anton Shevchuk
18
 */
19
class Str
20
{
21
    /**
22
     * Convert string to CamelCase
23
     *
24
     * @param  string $subject
25
     *
26
     * @return string
27
     */
28 561
    public static function toCamelCase($subject): string
29
    {
30 561
        $subject = str_replace(['_', '-'], ' ', strtolower($subject));
31 561
        return str_replace(' ', '', ucwords($subject));
32
    }
33
}
34