Inflector.php 498 B

12345678910111213141516
  1. <?php
  2. class LtInflector
  3. {
  4. public $conf = array("separator" => "_");
  5. public function camelize($uncamelized_words)
  6. {
  7. $uncamelized_words = $this->conf["separator"] . str_replace($this->conf["separator"] , " ", strtolower($uncamelized_words));
  8. return ltrim(str_replace(" ", "", ucwords($uncamelized_words)), $this->conf["separator"] );
  9. }
  10. public function uncamelize($camelCaps)
  11. {
  12. return strtolower(preg_replace('/([a-z])([A-Z])/', "$1" . $this->conf["separator"] . "$2", $camelCaps));
  13. }
  14. }