PHP Класс LazyRecord\Inflector

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$_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