Helper   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 1 Features 1
Metric Value
wmc 3
c 2
b 1
f 1
lcom 0
cbo 0
dl 0
loc 22
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A camelCaseToUnderscore() 0 14 3
1
<?php
2
3
namespace Saxulum\Crud\Util;
4
5
class Helper
6
{
7
    /**
8
     * @param string $input
9
     *
10
     * @return string
11
     */
12
    public static function camelCaseToUnderscore($input)
13
    {
14
        $output = '';
15
        $outputParts = preg_split('/(?=[\p{Lu}])/', $input);
16
        foreach ($outputParts as $outputPart) {
17
            if ($outputPart) {
18
                $output .= rtrim($outputPart, '_').'_';
19
            }
20
        }
21
22
        $output = mb_strtolower(rtrim($output, '_'));
23
24
        return $output;
25
    }
26
}
27