CamelCaseToSnakeCaseConverter   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 16
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A convert() 0 13 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Paysera\Bundle\ApiBundle\Service\Validation;
5
6
class CamelCaseToSnakeCaseConverter implements PropertyPathConverterInterface
7
{
8 10
    public function convert($path)
9
    {
10 10
        return ltrim(
11 10
            mb_strtolower(
12 10
                preg_replace(
13 10
                    '/[A-Z]/u',
14 10
                    '_$0',
15 10
                    $path
16
                )
17
            ),
18 10
            '_'
19
        );
20
    }
21
}
22