PHPonTrax
[ class tree: PHPonTrax ] [ index: PHPonTrax ] [ all elements ]

Class: Inflector

Source Location: /vendor/trax/inflector.php

Class Overview


Implement the Trax naming convention


Author(s):

Methods



Class Details

[line 42]
Implement the Trax naming convention

This class provides static methods to implement the Trax naming convention. Inflector is never instantiated.




Tags:

tutorial:  Inflector


[ Top ]


Class Methods


method camelize [line 102]

string camelize( string $lower_case_and_underscored_word)

Convert a phrase from the lower case and underscored form to the camel case form



Tags:

return:  Camel case form of the phrase


Parameters:

string   $lower_case_and_underscored_word   Phrase to convert

[ Top ]

method capitalize [line 90]

string capitalize( string $word)

Capitalize a word making it all lower case with first letter uppercase



Tags:

return:  Capitalized $word


Parameters:

string   $word   Word to be capitalized

[ Top ]

method classify [line 169]

string classify( string $table_name)

Convert a table name to the corresponding class name



Tags:

return:  Singular CamelCase form of $table_name
usedby:  TraxGenerator::generate_scaffold()


Parameters:

string   $table_name   Name of table in the database

[ Top ]

method dasherize [line 146]

string dasherize( string $underscored_word)

Convert a word's underscores into dashes



Tags:

return:  All underscores converted to dashes


Parameters:

string   $underscored_word   Word to convert

[ Top ]

method foreign_key [line 180]

string foreign_key( $class_name, string $table_name)

Get foreign key column corresponding to a table name



Tags:

return:  Column name of the foreign key column


Parameters:

string   $table_name   Name of table referenced by foreign key
   $class_name  

[ Top ]

method humanize [line 126]

string humanize( string $lower_case_and_underscored_word)

Generate a more human version of a lower case underscored word



Tags:

return:  The input value with underscores replaced by blanks and the first letter of each word capitalized
usedby:  TraxGenerator::generate_scaffold()
usedby:  ActiveRecordHelper::error_messages_for()
usedby:  ActiveRecord::set_content_columns()


Parameters:

string   $lower_case_and_underscored_word   A word or phrase in lower_case_underscore form

[ Top ]

method ordinalize [line 192]

string ordinalize( integer $number)

Add to a number st, nd, rd, th



Tags:

return:  Number formatted with correct st, nd, rd, or th


Parameters:

integer   $number   Number to append to key

[ Top ]

method pluralize [line 54]

string pluralize( string $word, [int $count = 0])

Pluralize a word according to English rules

Convert a lower-case singular word to plural form. If $count > 0 then prefixes $word with the $count




Tags:

return:  Plural of $word
usedby:  TraxGenerator::generate_scaffold()


Parameters:

string   $word   Word to be pluralized
int   $count   How many of these $words are there

[ Top ]

method singularize [line 73]

string singularize( string $word)

Singularize a word according to English rules



Tags:

return:  Singular of $word
usedby:  TraxGenerator::generate_scaffold()


Parameters:

string   $word   Word to be singularized

[ Top ]

method tableize [line 159]

string tableize( string $class_name)

Convert a class name to the corresponding table name

The class name is a singular word or phrase in CamelCase. By convention it corresponds to a table whose name is a plural word or phrase in lower case underscore form.




Tags:

return:  Pluralized lower_case_underscore form of name
usedby:  ActiveRecord::set_table_name_using_class_name()


Parameters:

string   $class_name   Name of ActiveRecord sub-class

[ Top ]

method titleize [line 136]

string titleize( string $word)

Convert a word or phrase into a title format "Welcome To My Site"



Tags:

return:  A string that has all words capitalized and splits on existing caps.


Parameters:

string   $word   A word or phrase

[ Top ]

method underscore [line 113]

string underscore( string $camel_cased_word)

Convert a phrase from the camel case form to the lower case and underscored form



Tags:

return:  Lower case and underscored form of the phrase
usedby:  TraxGenerator::generate_scaffold()
usedby:  TraxGenerator::generate_model()
usedby:  TraxGenerator::generate_controller()


Parameters:

string   $camel_cased_word   Phrase to convert

[ Top ]


Documentation generated on Mon, 21 May 2007 22:28:37 -0600 by phpDocumentor 1.3.2