Strings::stripCamelCasePrefix()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 6
nc 3
nop 2
dl 0
loc 10
ccs 7
cts 7
cp 1
crap 3
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace AmaTeam\TreeAccess\Misc;
4
5
class Strings
6
{
7
    /**
8
     * @param string $subject
9
     * @param string $prefix
10
     * @return string|false
11
     */
12 12
    public static function stripCamelCasePrefix($subject, $prefix)
13
    {
14 12
        if ($prefix === $subject) {
15 1
            return '';
16
        }
17 11
        if (strpos($subject, $prefix) !== 0) {
18 10
            return false;
19
        }
20 10
        $cut = substr($subject, strlen($prefix));
21 10
        return strtolower($cut[0]) . substr($cut, 1);
22
    }
23
}
24