Skip to content
Permalink
Browse files

Cleaning up formatting.

  • Loading branch information...
jperras committed Apr 10, 2009
1 parent 67fffaa commit d72dad581a0ac105501b07f18d7354ad41dc72c4
Showing with 14 additions and 1 deletion.
  1. +14 −1 cake/libs/inflector.php
@@ -43,6 +43,7 @@
* @link http://book.cakephp.org/view/491/Inflector
*/
class Inflector extends Object {
/**
* Plural inflector rules
*
@@ -109,6 +110,7 @@ class Inflector extends Object {
'turf' => 'turfs'
)
);
/**
* Singular inflector rules
*
@@ -156,6 +158,7 @@ class Inflector extends Object {
),
'irregular' => array()
);
/**
* Words that should not be inflected
*
@@ -177,21 +180,22 @@ class Inflector extends Object {
'Yengeese'
);
/**
* Cached array identity map of pluralized words.
*
* @var array
* @access protected
**/
var $_pluralized = array();
/**
* Cached array identity map of singularized words.
*
* @var array
* @access protected
**/
var $_singularized = array();
/**
* Gets a reference to the Inflector object instance
*
@@ -206,6 +210,7 @@ function &getInstance() {
}
return $instance[0];
}
/**
* Adds custom inflection $rules, of either 'plural' or 'singular' $type.
*
@@ -234,6 +239,7 @@ function rules($type, $rules = array()) {
$_this->{$type}['rules'] = array_merge($rules, $_this->{$type}['rules']);
}
/**
* Return $word in plural form.
*
@@ -329,6 +335,7 @@ function singularize($word) {
$_this->_singularized[$word] = $word;
return $word;
}
/**
* Returns the given lower_case_and_underscored_word as a CamelCased word.
*
@@ -341,6 +348,7 @@ function singularize($word) {
function camelize($lowerCaseAndUnderscoredWord) {
return str_replace(" ", "", ucwords(str_replace("_", " ", $lowerCaseAndUnderscoredWord)));
}
/**
* Returns the given camelCasedWord as an underscored_word.
*
@@ -353,6 +361,7 @@ function camelize($lowerCaseAndUnderscoredWord) {
function underscore($camelCasedWord) {
return strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $camelCasedWord));
}
/**
* Returns the given underscored_word_group as a Human Readable Word Group.
* (Underscores are replaced by spaces and capitalized following words.)
@@ -366,6 +375,7 @@ function underscore($camelCasedWord) {
function humanize($lowerCaseAndUnderscoredWord) {
return ucwords(str_replace("_", " ", $lowerCaseAndUnderscoredWord));
}
/**
* Returns corresponding table name for given model $className. ("people" for the model class "Person").
*
@@ -378,6 +388,7 @@ function humanize($lowerCaseAndUnderscoredWord) {
function tableize($className) {
return Inflector::pluralize(Inflector::underscore($className));
}
/**
* Returns Cake model class name ("Person" for the database table "people".) for given database table.
*
@@ -390,6 +401,7 @@ function tableize($className) {
function classify($tableName) {
return Inflector::camelize(Inflector::singularize($tableName));
}
/**
* Returns camelBacked version of an underscored string.
*
@@ -404,6 +416,7 @@ function variable($string) {
$replace = strtolower(substr($string, 0, 1));
return preg_replace('/\\w/', $replace, $string, 1);
}
/**
* Returns a string with all spaces converted to underscores (by default), accented
* characters converted to non-accented characters, and non word characters removed.

0 comments on commit d72dad5

Please sign in to comment.
You can’t perform that action at this time.