public static
|
|
public static
|
#
addWord( string $singular, string $plural )
Add a word to the cache, useful to make exceptions or to add words in other
languages.
Add a word to the cache, useful to make exceptions or to add words in other
languages.
Parameters
- $singular
string - $singular word.
- $plural
string - $plural word.
|
public static
string
|
#
pluralize( string $word )
Singular English word to plural.
Singular English word to plural.
Parameters
- $word
string - $word word to pluralize.
Returns
string - Plural noun.
|
public static
string
|
#
singularize( string $word )
Plural English word to singular.
Plural English word to singular.
Parameters
- $word
string - $word Word to singularize.
Returns
string - Singular noun.
|
public static
string
|
#
camelize( string $word )
Returns given word as CamelCased.
Returns given word as CamelCased.
Converts a word like "foo_bar" or "foo bar" to "FooBar". It will remove non
alphanumeric characters from the word, so "who's online" will be converted to
"WhoSOnline"
Parameters
- $word
string - $word Word to convert to camel case.
Returns
string - UpperCamelCasedWord
|
public static
string
|
#
underscore( string $word )
Converts a word "into_it_s_underscored_version"
Converts a word "into_it_s_underscored_version"
Convert any "CamelCased" or "ordinary Word" into an "underscored_word".
Parameters
- $word
string - $word Word to underscore
Returns
string - Underscored word
|
public static
array
|
#
explode( string $word )
Convert any "CamelCased" word into an array of strings
Convert any "CamelCased" word into an array of strings
Returns an array of strings each of which is a substring of string formed by
splitting it at the camelcased letters.
Parameters
- $word
string - $word Word to explode
Returns
array - Array of strings
|
public static
string
|
#
implode( array $words )
Convert an array of strings into a "CamelCased" word.
Convert an array of strings into a "CamelCased" word.
Parameters
- $words
array - $words Array to implode
Returns
string - UpperCamelCasedWord
|
public static
string
|
#
humanize( string $word )
Returns a human-readable string from $word.
Returns a human-readable string from $word.
Returns a human-readable string from $word, by replacing underscores with a
space, and by upper-casing the initial character by default.
Parameters
- $word
string - $word String to "humanize"
Returns
string - Human-readable word
|
public static
string
|
#
tableize( string $className )
Converts a class name to its table name according to Koowa naming
conventions.
Converts a class name to its table name according to Koowa naming
conventions.
Converts "Person" to "people"
Parameters
- $className
string - $className Class name for getting related table_name.
Returns
string - plural_table_name
See
|
public static
string
|
#
classify( string $tableName )
Converts a table name to its class name according to Koowa naming
conventions.
Converts a table name to its class name according to Koowa naming
conventions.
Parameters
- $tableName
string - $tableName Table name for getting related ClassName.
Returns
string - SingularClassName
See
Example
Converts "people" to "Person"
|
public static
string
|
#
variablize( string $string )
Returns camelBacked version of a string. Same as camelize but first char is
lowercased.
Returns camelBacked version of a string. Same as camelize but first char is
lowercased.
Parameters
- $string
string - $string String to be camelBacked.
Returns
string
See
|
public static
boolean
|
#
isSingular( string $string )
Check to see if an English word is singular
Check to see if an English word is singular
Parameters
- $string
string - $string The word to check
Returns
boolean
|
public static
boolean
|
#
isPlural( string $string )
Check to see if an Enlish word is plural.
Check to see if an Enlish word is plural.
Parameters
- $string
string - $string String to be checked.
Returns
boolean
|
public static
string
|
#
getPart( string $string, integer $index, string $default = null )
Gets a part of a CamelCased word by index.
Gets a part of a CamelCased word by index.
Use a negative index to start at the last part of the word (-1 is the last
part)
Parameters
- $string
string - $string Word
- $index
integer - $index Index of the part
- $default
string - $default Default value
Returns
string
|