Inflector Class Reference

Inheritance diagram for Inflector:

Object

List of all members.


Public Member Functions

getInstance ()

Static Public Member Functions

 camelize ($lowerCaseAndUnderscoredWord)
 classify ($tableName)
 humanize ($lowerCaseAndUnderscoredWord)
 pluralize ($word)
 singularize ($word)
 slug ($string, $replacement= '_')
 tableize ($className)
 underscore ($camelCasedWord)
 variable ($string)

Detailed Description

Definition at line 49 of file inflector.php.


Member Function Documentation

Inflector::classify ( tableName  )  [static]

Returns Cake model class name ("Post" for the database table "posts".) for given database table.

Parameters:
string $tableName Name of database table to get class name for
Returns:
string public

Definition at line 404 of file inflector.php.

References camelize(), and singularize().

Referenced by TestTask::bake(), PluginTask::execute(), BakeShell::loadTasks(), and CakeSchema::read().

& Inflector::getInstance (  ) 

Gets a reference to the Inflector object instance

Returns:
object public

Definition at line 63 of file inflector.php.

Referenced by Configure::listObjects(), pluralize(), and singularize().

Inflector::humanize ( lowerCaseAndUnderscoredWord  )  [static]

Returns a human-readable string from $lower_case_and_underscored_word, by replacing underscores with a space, and by upper-casing the initial characters.

Parameters:
string $lower_case_and_underscored_word String to be made more readable
Returns:
string Human-readable string public

Definition at line 380 of file inflector.php.

Referenced by Shell::_pluralHumanName(), Shell::_singularHumanName(), ControllerTask::bakeActions(), PagesController::display(), FormHelper::error(), FormHelper::inputs(), FormHelper::label(), FormHelper::radio(), View::renderLayout(), and PaginatorHelper::sort().

Inflector::pluralize ( word  )  [static]

Return $word in plural form.

Parameters:
string $word Word in singular
Returns:
string Word in plural public

Definition at line 166 of file inflector.php.

References $pluralRules, and getInstance().

Referenced by Model::_clearCache(), Shell::_controllerName(), Shell::_pluralHumanName(), Shell::_pluralName(), FormHelper::create(), PluginTask::execute(), FormHelper::input(), BakeShell::loadTasks(), AclNode::node(), and tableize().

Inflector::singularize ( word  )  [static]

Return $word in singular form.

Parameters:
string $word Word in plural
Returns:
string Word in singular public

Definition at line 310 of file inflector.php.

References $singularRules, and getInstance().

Referenced by Shell::_modelKey(), Shell::_modelName(), Shell::_singularHumanName(), Shell::_singularName(), and classify().

Inflector::slug ( string,
replacement = '_' 
) [static]

Returns a string with all spaces converted to $replacement and non word characters removed.

Parameters:
string $string
string $replacement
Returns:
string public

Definition at line 431 of file inflector.php.

References String::insert().

Referenced by CacheHelper::cache(), Dispatcher::cached(), View::element(), XcacheEngine::init(), MemcacheEngine::init(), ApcEngine::init(), DataSource::listSources(), and XmlNode::normalize().

Inflector::tableize ( className  )  [static]

Returns corresponding table name for given $class_name. ("posts" for the model class "Post").

Parameters:
string $class_name Name of class to get database table name for
Returns:
string Name of the database table for given class public

Definition at line 392 of file inflector.php.

References pluralize(), and underscore().

Referenced by ModelTask::bake(), ModelTask::doAssociations(), and ModelTask::fixture().

Inflector::variable ( string  )  [static]

Returns camelBacked version of a string.

Parameters:
string $string
Returns:
string public

Definition at line 416 of file inflector.php.

References camelize(), and underscore().

Referenced by Shell::_pluralName(), View::_render(), Shell::_singularName(), ControllerTask::bakeActions(), ShellDispatcher::dispatch(), FormHelper::input(), and Controller::set().


The documentation for this class was generated from the following file: