PHP 클래스 FOF30\Inflector\Inflector

파일 보기 프로젝트 열기: akeeba/fof

보호된 프로퍼티들

프로퍼티 타입 설명
$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