deblan.tv/vendor/trinity/src/Trinity/Component/Utils/Propel.php
2015-03-02 21:57:49 +01:00

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
));
}
}