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

ToUnderscores::map()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 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
}