PHP Класс FOF30\Inflector\Inflector

Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$cache array Cache of pluralized and singularized nouns.
$rules array Rules for pluralizing and singularizing of nouns.

Открытые методы

Метод Описание
addWord ( string $singular, string $plural ) : void Add a word to the cache, useful to make exceptions or to add words in other languages.
camelize ( string $word ) : string Returns given word as CamelCased.
deleteCache ( )
explode ( string $word ) : array Convert any "CamelCased" word into an array of strings
getPart ( string $string, integer $index, string $default = null ) : string Gets a part of a CamelCased word by index.
humanize ( string $word ) : string Returns a human-readable string from $word.
implode ( array $words ) : string Convert an array of strings into a "CamelCased" word.
isPlural ( string $string ) : boolean Check to see if an Enlish word is plural.
isSingular ( string $string ) : boolean Check to see if an English word is singular
pluralize ( string $word ) : string Singular English word to plural.
singularize ( string $word ) : string Plural English word to singular.
underscore ( string $word ) : string Converts a word "into_it_s_underscored_version"
variablize ( string $string ) : string Returns camelBacked version of a string. Same as camelize but first char is lowercased.

Описание методов

addWord() публичный Метод

Add a word to the cache, useful to make exceptions or to add words in other languages.
public addWord ( string $singular, string $plural ) : void
$singular string word.
$plural string word.
Результат void

camelize() публичный Метод

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"
public camelize ( string $word ) : string
$word string Word to convert to camel case.
Результат string UpperCamelCasedWord

deleteCache() публичный Метод

public deleteCache ( )

explode() публичный Метод

Returns an array of strings each of which is a substring of string formed by splitting it at the camelcased letters.
public explode ( string $word ) : array
$word string Word to explode
Результат array Array of strings

getPart() публичный Метод

Use a negative index to start at the last part of the word (-1 is the last part)
public getPart ( string $string, integer $index, string $default = null ) : string
$string string Word
$index integer Index of the part
$default string Default value
Результат string

humanize() публичный Метод

Returns a human-readable string from $word, by replacing underscores with a space, and by upper-casing the initial character by default.
public humanize ( string $word ) : string
$word string String to "humanize"
Результат string Human-readable word

implode() публичный Метод

Convert an array of strings into a "CamelCased" word.
public implode ( array $words ) : string
$words array Array to implode
Результат string UpperCamelCasedWord

isPlural() публичный Метод

Check to see if an Enlish word is plural.
public isPlural ( string $string ) : boolean
$string string String to be checked.
Результат boolean

isSingular() публичный Метод

Check to see if an English word is singular
public isSingular ( string $string ) : boolean
$string string The word to check
Результат boolean

pluralize() публичный Метод

Singular English word to plural.
public pluralize ( string $word ) : string
$word string word to pluralize.
Результат string Plural noun.

singularize() публичный Метод

Plural English word to singular.
public singularize ( string $word ) : string
$word string Word to singularize.
Результат string Singular noun.

underscore() публичный Метод

Convert any "CamelCased" or "ordinary Word" into an "underscored_word".
public underscore ( string $word ) : string
$word string Word to underscore
Результат string Underscored word

variablize() публичный Метод

Returns camelBacked version of a string. Same as camelize but first char is lowercased.
См. также: camelize
public variablize ( string $string ) : string
$string string String to be camelBacked.
Результат string

Описание свойств

$cache защищенное свойство

Cache of pluralized and singularized nouns.
protected array $cache
Результат array

$rules защищенное свойство

Rules for pluralizing and singularizing of nouns.
protected array $rules
Результат array