Completed
Pull Request — master (#19)
by Romain
02:15
created

UtilityTrait::camelize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
nc 1
cc 1
eloc 2
nop 2
crap 2
1
<?php
2
namespace Kerox\Messenger\Helper;
3
4
trait UtilityTrait
5
{
6
7
    /**
8
     * Returns the input lower_case_delimited_string as a CamelCasedString.
9
     *
10
     * @param string $string String to be camelize
11
     * @param string $delimiter The delimiter in the input string
12
     * @return string
13
     */
14
    public static function camelize(string $string, string $delimiter = '_'): string
15
    {
16
        return implode('', array_map('ucfirst', array_map('strtolower', explode($delimiter, $string))));
17
    }
18
}
19