Inflector

pluralize($word)

7: 	function pluralize($word) {
8: 		if (isset($this->irregulars[$word])) {
9: 			return $this->irregulars[$word];
10: 		}
11:
12: 		foreach($this->plurals as $parent => $replacement) {
13: 			if (preg_match($parent, $word)) {
14: 				return preg_replace($parent, $replacement, $word);
15: 			}
16: 		}
17:
18: 		return $word;
19: 	}

File: lib/support/Inflector.php, #line 7

singularize($word)

24: 	function singularize($word) {
25: 		if ($key = array_search($word, $this->irregulars)) {
26: 			return $key;
27: 		}
28:
29: 		foreach($this->singulars as $parent => $replacement) {
30: 			if (preg_match($parent, $word)) {
31: 				return preg_replace($parent, $replacement, $word);
32: 			}
33: 		}
34:
35: 		return $word;
36: 	}

File: lib/support/Inflector.php, #line 24

tableize($class_name)

41: 	function tableize($class_name) {
42: 		return $this->pluralize($this->underscore($class_name));
43: 	}

File: lib/support/Inflector.php, #line 41

underscore($class_name)

48: 	function underscore($class_name) {
49: 		return strtolower(preg_replace('/(?<=\w)([A-Z])/', '_\1', $class_name));
50: 	}

File: lib/support/Inflector.php, #line 48

ordinalize($number)

55: 	function ordinalize($number) {
56:
57: 	}

File: lib/support/Inflector.php, #line 55

dasherize($word)

62: 	function dasherize($word) {
63: 		return preg_replace('/_/','-', $word);
64: 	}

File: lib/support/Inflector.php, #line 62

camelize($string)

69: 	function camelize($string) {
70: 		$string = explode('_', $string);
71: 		$string_w = '';
72: 		foreach($string as $word) {
73: 			$string_w .= ucwords($word);
74: 		}
75: 		return $string_w;
76: 	}

File: lib/support/Inflector.php, #line 69

humanize($word)

81: 	function humanize($word) {
82: 		$word = preg_replace('/_/', ' ', $word);
83: 		return ucwords($word);
84: 	}

File: lib/support/Inflector.php, #line 81

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>