Strings   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A stripCamelCasePrefix() 0 10 3
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