PHP Class LazyRecord\Inflector

Afficher le fichier Open project: corneltek/lazyrecord Class Usage Examples

Méthodes publiques

Свойство Type Description
$_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

Méthodes publiques

Méthode Description
_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.

Method Details

_cache() public méthode

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
Résultat string Inflected value, from cache

camelize() public méthode

Returns the given lower_case_and_underscored_word as a CamelCased word.
public camelize ( $lowerCaseAndUnderscoredWord ) : string
Résultat string Camelized word. LikeThis.

classify() public méthode

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
Résultat string Class name

getInstance() public static méthode

Gets a reference to the Inflector object instance.
public static getInstance ( ) : object
Résultat object

humanize() public méthode

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

pluralize() public méthode

Return $word in plural form.
public pluralize ( string $word ) : string
$word string Word in singular
Résultat string Word in plural

rules() public méthode

### 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() public méthode

Return $word in singular form.
public singularize ( string $word ) : string
$word string Word in plural
Résultat string Word in singular

slug() public méthode

Returns a string with all spaces converted to underscores (by default), accented characters converted to non-accented characters, and non word characters removed.
Deprecation: $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
Résultat string

tableize() public méthode

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
Résultat string Name of the database table for given class

underscore() public méthode

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

variable() public méthode

Returns camelBacked version of an underscored string.
public variable ( string $string ) : string
$string string
Résultat string in variable form

Property Details

$_camelize public_oe property

* Cached Camelize Inflections
public $_camelize

$_classify public_oe property

* Classify cached inflecctions
public $_classify

$_humanize public_oe property

* Humanize cached inflections
public $_humanize

$_plural public_oe property

* Plural inflector rules
public $_plural

$_pluralized public_oe property

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

$_singular public_oe property

* Singular inflector rules
public $_singular

$_singularized public_oe property

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

$_tableize public_oe property

* Tablize cached inflections
public $_tableize

$_transliteration public_oe property

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

$_underscore public_oe property

* Cached Underscore Inflections
public $_underscore

$_uninflected public_oe property

* Words that should not be inflected
public $_uninflected