Completed
Push — master ( c6b9dc...9b6af1 )
by Paweł
02:25
created

ToUnderscores   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 7
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 7
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A map() 0 4 1
1
<?php
2
3
namespace Agares\MicroORM\FieldNameMappers;
4
5
use Agares\MicroORM\FieldNameMapperInterface;
6
7
class ToUnderscores implements FieldNameMapperInterface
8
{
9
	public function map(string $getterName) : string
10
	{
11
		return preg_replace_callback('/[A-Z]/', function($x) { return '_'.strtolower($x[0]); }, lcfirst(substr($getterName, 3)));
12
	}
13
}