Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
3 / 3 |
ToClassCamelCaseStrategy | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
transform | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
<?php | |
namespace Siesta\NamingStrategy; | |
class ToClassCamelCaseStrategy implements NamingStrategy | |
{ | |
/** | |
* @param string $value | |
* | |
* @return string | |
*/ | |
public function transform(string $value) : string | |
{ | |
$func = create_function('$c', 'return strtoupper($c[1]);'); | |
$camelCase = preg_replace_callback('/_([a-z])/', $func, $value); | |
return ucfirst($camelCase); | |
} | |
} |