审查视图

simplewind/extend/alipay/lotusphp_runtime/Inflector/Inflector.php 498 字节
lihan authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<?php
class LtInflector
{
	public $conf = array("separator" => "_");

	public function camelize($uncamelized_words)
	{
		$uncamelized_words = $this->conf["separator"] . str_replace($this->conf["separator"] , " ", strtolower($uncamelized_words));
		return ltrim(str_replace(" ", "", ucwords($uncamelized_words)), $this->conf["separator"] );
	}

	public function uncamelize($camelCaps)
	{
		return strtolower(preg_replace('/([a-z])([A-Z])/', "$1" . $this->conf["separator"] . "$2", $camelCaps));
	}
}