From 5f035ca34071f20ead8dbec5d018236ab3f70814 Mon Sep 17 00:00:00 2001 From: jperras Date: Sat, 21 Mar 2009 21:38:32 -0400 Subject: [PATCH] Adding doc blocks for new inflector class variables & rules method. --- cake/libs/inflector.php | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/cake/libs/inflector.php b/cake/libs/inflector.php index ca62d0f64cf..aaaa7b3b194 100644 --- a/cake/libs/inflector.php +++ b/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();