Inflector
extends DataObject
in package
implements
InflectorInterface
Language inflection such as pluralisation.
Includes utilities for converting between snake/camel/kebab string formats.
DO NOT use this for i18n. This is strictly for inflection of INTERNAL CODE UTILITIES.
Table of Contents
Interfaces
- InflectorInterface
- Language inflection (in English) for pluralisation.
Properties
- $irregular : array<string, string>
- $uncountable : array<string|int, string>
- $_cache : array<string|int, mixed>
Methods
- __construct() : mixed
- camelize() : string
- Makes a phrase camel case.
- humanize() : string
- Makes a phrase human-readable from any form (kebab, underscore, camel).
- kebab() : string
- Makes a phrase kebab-case.
- plural() : string
- Makes a singular word plural.
- singular() : string
- Makes a plural word singular.
- uncountable() : bool
- Checks if a word is defined as uncountable.
- underscore() : string
- Makes a phrase underscored.
- update() : void
- Update the object with a new configuration.
- _plural() : string
- Makes a singular word plural.
- _singular() : string
- Makes a plural word singular.
Properties
$irregular
public
array<string, string>
$irregular
= []
$uncountable
public
array<string|int, string>
$uncountable
= []
$_cache
protected
array<string|int, mixed>
$_cache
= []
Methods
__construct()
public
__construct([mixed $config = null ]) : mixed
Parameters
- $config : mixed = null
Tags
camelize()
Makes a phrase camel case.
public
static camelize(string $phrase[, bool $first = true ]) : string
Parameters
- $phrase : string
- $first : bool = true
-
Upper case the first letter
Return values
stringhumanize()
Makes a phrase human-readable from any form (kebab, underscore, camel).
public
static humanize(string $phrase) : string
Parameters
- $phrase : string
Return values
stringkebab()
Makes a phrase kebab-case.
public
static kebab(string $phrase) : string
Parameters
- $phrase : string
Return values
stringplural()
Makes a singular word plural.
public
plural(string $word[, int $count = 0 ]) : string
Parameters
- $word : string
- $count : int = 0
Return values
stringsingular()
Makes a plural word singular.
public
singular(string $word[, int $count = 1 ]) : string
Parameters
- $word : string
- $count : int = 1
-
number of things
Return values
stringuncountable()
Checks if a word is defined as uncountable.
public
uncountable(string $word) : bool
Parameters
- $word : string
Return values
boolunderscore()
Makes a phrase underscored.
public
static underscore(string $phrase) : string
Parameters
- $phrase : string
Return values
stringupdate()
Update the object with a new configuration.
public
update(iterable<string|int, mixed> $config) : void
Parameters
- $config : iterable<string|int, mixed>
Tags
_plural()
Makes a singular word plural.
protected
_plural(string $word[, int $count = 0 ]) : string
Parameters
- $word : string
- $count : int = 0
Return values
string_singular()
Makes a plural word singular.
protected
_singular(string $word[, int $count = 1 ]) : string
Parameters
- $word : string
- $count : int = 1
-
number of things