Skip to content
Permalink
Browse files

Adding doc blocks for new inflector class variables & rules method.

  • Loading branch information...
jperras committed Mar 22, 2009
1 parent 0d8d8fa commit 5f035ca34071f20ead8dbec5d018236ab3f70814
Showing with 29 additions and 7 deletions.
  1. +29 −7 cake/libs/inflector.php
@@ -46,7 +46,12 @@
* @link http://book.cakephp.org/view/491/Inflector
*/
class Inflector extends Object {
/**
* Plural inflector rules
*
* @var array
* @access public
**/
var $plural = array(
'rules' => array(
'/(s)tatus$/i' => '\1\2tatuses',
@@ -107,7 +112,12 @@ class Inflector extends Object {
'turf' => 'turfs'
)
);
/**
* Singular inflector rules
*
* @var array
* @access public
**/
var $singular = array(
'rules' => array(
'/(s)tatuses$/i' => '\1\2tatus',
@@ -149,7 +159,12 @@ class Inflector extends Object {
),
'irregular' => array()
);
/**
* Words that should not be inflected
*
* @var array
* @access public
**/
var $uninflected = array(
'Amoyese', 'bison', 'Borghese', 'bream', 'breeches', 'britches', 'buffalo', 'cantus',
'carp', 'chassis', 'clippers', 'cod', 'coitus', 'Congoese', 'contretemps', 'corps',
@@ -203,12 +218,19 @@ function &getInstance() {
return $instance[0];
}
/**
* undocumented function
* Adds custom inflection $rules, of either 'plural' or 'singular' $type.
*
* @param string $type
* @param string $rules
* @param string $type The type of inflection, either 'singular' or 'plural'
* @param array $rules Array of rules to be added. Example usage:
* Inflector::rules('plural', array('/^(inflect)or$/i' => '\1ables'));
* Inflector::rules('plural', array(
* 'rules' => array('/^(inflect)ors$/i' => '\1ables'),
* 'uninflected' => array('dontinflectme'),
* 'irregular' => array('red' => 'redlings')
* ));
* @access public
* @return void
* @author Joel Perras
* @static
*/
function rules($type, $rules = array()) {
$_this =& Inflector::getInstance();

0 comments on commit 5f035ca

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