28 lines
545 B
PHP
28 lines
545 B
PHP
|
<?php
|
||
|
|
||
|
namespace Trinity\Component\Utils;
|
||
|
|
||
|
class Propel
|
||
|
{
|
||
|
public static function getGetter($field)
|
||
|
{
|
||
|
return 'get'.self::camelCase($field);
|
||
|
}
|
||
|
|
||
|
public static function getSetter($field)
|
||
|
{
|
||
|
return 'set'.self::camelCase($field);
|
||
|
}
|
||
|
|
||
|
public static function camelCase($string)
|
||
|
{
|
||
|
return ucfirst(preg_replace_callback(
|
||
|
'/_[a-z0-9]{1}/iU',
|
||
|
function($matches) {
|
||
|
return str_replace('_', '', strtoupper($matches[0]));
|
||
|
},
|
||
|
$string
|
||
|
));
|
||
|
}
|
||
|
}
|