PHP 클래스 LazyRecord\Inflector

파일 보기 프로젝트 열기: corneltek/lazyrecord 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$_camelize * Cached Camelize Inflections
$_classify * Classify cached inflecctions
$_humanize * Humanize cached inflections
$_plural * Plural inflector rules
$_pluralized * Cached array identity map of pluralized words.
$_singular * Singular inflector rules
$_singularized * Cached array identity map of singularized words.
$_tableize * Tablize cached inflections
$_transliteration * Default map of accented and special characters to ASCII characters
$_underscore * Cached Underscore Inflections
$_uninflected * Words that should not be inflected

공개 메소드들

메소드 설명
_cache ( string $type, string $key, string $value = false ) : string Cache inflected values, and return if already available.
camelize ( $lowerCaseAndUnderscoredWord ) : string Returns the given lower_case_and_underscored_word as a CamelCased word.
classify ( string $tableName ) : string Returns Cake model class name ("Person" for the database table "people".) for given database table.
getInstance ( ) : object Gets a reference to the Inflector object instance.
humanize ( $lowerCaseAndUnderscoredWord ) : string Returns the given underscored_word_group as a Human Readable Word Group.
pluralize ( string $word ) : string Return $word in plural form.
rules ( string $type, array $rules, boolean $reset = false ) Adds custom inflection $rules, of either 'plural', 'singular' or 'transliteration' $type.
singularize ( string $word ) : string Return $word in singular form.
slug ( string $string, string $replacement = '_', array $map = [] ) : string Returns a string with all spaces converted to underscores (by default), accented characters converted to non-accented characters, and non word characters removed.
tableize ( string $className ) : string Returns corresponding table name for given model $className. ("people" for the model class "Person").
underscore ( string $camelCasedWord ) : string Returns the given camelCasedWord as an underscored_word.
variable ( string $string ) : string Returns camelBacked version of an underscored string.

메소드 상세

_cache() 공개 메소드

Cache inflected values, and return if already available.
public _cache ( string $type, string $key, string $value = false ) : string
$type string Inflection type
$key string Original value
$value string Inflected value
리턴 string Inflected value, from cache

camelize() 공개 메소드

Returns the given lower_case_and_underscored_word as a CamelCased word.
public camelize ( $lowerCaseAndUnderscoredWord ) : string
리턴 string Camelized word. LikeThis.

classify() 공개 메소드

Returns Cake model class name ("Person" for the database table "people".) for given database table.
public classify ( string $tableName ) : string
$tableName string Name of database table to get class name for
리턴 string Class name

getInstance() 공개 정적인 메소드

Gets a reference to the Inflector object instance.
public static getInstance ( ) : object
리턴 object

humanize() 공개 메소드

(Underscores are replaced by spaces and capitalized following words.).
public humanize ( $lowerCaseAndUnderscoredWord ) : string
리턴 string Human-readable string

pluralize() 공개 메소드

Return $word in plural form.
public pluralize ( string $word ) : string
$word string Word in singular
리턴 string Word in plural

rules() 공개 메소드

### Usage: {{{ Inflector::rules('plural', array('/^(inflect)or$/i' => '\1ables')); Inflector::rules('plural', array( 'rules' => array('/^(inflect)ors$/i' => '\1ables'), 'uninflected' => array('dontinflectme'), 'irregular' => array('red' => 'redlings') )); Inflector::rules('transliteration', array('/å/' => 'aa')); }}}
public rules ( string $type, array $rules, boolean $reset = false )
$type string The type of inflection, either 'plural', 'singular' or 'transliteration'
$rules array Array of rules to be added.
$reset boolean If true, will unset default inflections for all new rules that are being defined in $rules.

singularize() 공개 메소드

Return $word in singular form.
public singularize ( string $word ) : string
$word string Word in plural
리턴 string Word in singular

slug() 공개 메소드

Returns a string with all spaces converted to underscores (by default), accented characters converted to non-accented characters, and non word characters removed.
사용 중단: $map param will be removed in future versions. Use Inflector::rules() instead
public slug ( string $string, string $replacement = '_', array $map = [] ) : string
$string string the string you want to slug
$replacement string will replace keys in map
$map array extra elements to map to the replacement
리턴 string

tableize() 공개 메소드

Returns corresponding table name for given model $className. ("people" for the model class "Person").
public tableize ( string $className ) : string
$className string Name of class to get database table name for
리턴 string Name of the database table for given class

underscore() 공개 메소드

Returns the given camelCasedWord as an underscored_word.
public underscore ( string $camelCasedWord ) : string
$camelCasedWord string Camel-cased word to be "underscorized"
리턴 string Underscore-syntaxed version of the $camelCasedWord

variable() 공개 메소드

Returns camelBacked version of an underscored string.
public variable ( string $string ) : string
$string string
리턴 string in variable form

프로퍼티 상세

$_camelize 공개적으로 프로퍼티

* Cached Camelize Inflections
public $_camelize

$_classify 공개적으로 프로퍼티

* Classify cached inflecctions
public $_classify

$_humanize 공개적으로 프로퍼티

* Humanize cached inflections
public $_humanize

$_plural 공개적으로 프로퍼티

* Plural inflector rules
public $_plural

$_pluralized 공개적으로 프로퍼티

* Cached array identity map of pluralized words.
public $_pluralized

$_singular 공개적으로 프로퍼티

* Singular inflector rules
public $_singular

$_singularized 공개적으로 프로퍼티

* Cached array identity map of singularized words.
public $_singularized

$_tableize 공개적으로 프로퍼티

* Tablize cached inflections
public $_tableize

$_transliteration 공개적으로 프로퍼티

* Default map of accented and special characters to ASCII characters
public $_transliteration

$_underscore 공개적으로 프로퍼티

* Cached Underscore Inflections
public $_underscore

$_uninflected 공개적으로 프로퍼티

* Words that should not be inflected
public $_uninflected