ClassNameUtils   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 10
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getShortName() 0 7 1
1
<?php
2
3
namespace Dontdrinkandroot\Utils;
4
5
/**
6
 * @author Philip Washington Sorst <[email protected]>
7
 */
8
class ClassNameUtils
9
{
10
    public static function getShortName(string $className): string
11
    {
12
        $parts = explode("\\", $className);
13
        $lastPart = $parts[count($parts) - 1];
14
15
        return strtolower(preg_replace('~(?<=\\w)([A-Z])~', '_$1', $lastPart));
16
    }
17
}
18