* @copyright Copyright (c) 2010 Federico Cargnelutti * @license New BSD License * @version $Id: $ */ /** * @category Zf * @package Zf_Orm * @author Federico Cargnelutti * @copyright Copyright (c) 2010 Federico Cargnelutti * @license New BSD License * @version $Id: $ */ class Zf_Orm_StringInflector { /** * Converts a string to CamelCase. * * @param string $string * @return string */ public static function camelize($string) { return str_replace(' ', '', ucwords(preg_replace('/[^A-Z^a-z^0-9]+/', ' ', $string))); } /** * Creates an underscored and lowercase string. * * @param string $string * @return string */ public static function underscore($string) { return strtolower(preg_replace('/(?!^)[[:upper:]]/', '_' . '\0', $string)); } }