示例#1
0
 /**
  * addUncountable
  *
  * @return void
  * @author Justin Palmer
  **/
 public static function addUncountable($args)
 {
     $args = func_get_args();
     self::$uncountable = array_merge($args, self::$uncountable);
 }
示例#2
0
Inflections::singular('/(o)es$/i', '\\1');
Inflections::singular('/(shoe)s$/i', '\\1');
Inflections::singular('/(cris|ax|test)es$/i', '\\1is');
Inflections::singular('/([octop|vir])i$/i', '\\1us');
Inflections::singular('/(alias|status)es$/i', '\\1');
Inflections::singular('/^(ox)en/i', '\\1');
Inflections::singular('/(vert|ind)ices$/i', '\\1ex');
Inflections::singular('/(matr)ices$/i', '\\1ix');
Inflections::singular('/(quiz)zes$/i', '\\1');
Inflections::irregular('person', 'people');
Inflections::irregular('man', 'men');
Inflections::irregular('child', 'children');
Inflections::irregular('sex', 'sexes');
Inflections::irregular('move', 'moves');
Inflections::irregular('cow', 'kine');
Inflections::uncountable('equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep');
# End Default Inflections
/**
 *  Implement the Trax naming convention
 *
 *  Inflections is never instantiated.
 */
class Inflections
{
    public static $plurals = array(), $singulars = array(), $uncountables = array(), $humans = array();
    # Specifies a new pluralization rule and its replacement. The rule can either be a string or a regular expression.
    # The replacement should always be a string that may include references to the matched data from the rule.
    function plural($rule, $replacement)
    {
        array_unshift(self::$plurals, array("rule" => $rule, "replacement" => $replacement));
    }