Documentation

Inflector
in package

Language inflection such as pluralisation.

Table of Contents

Properties

$cache  : mixed
$irregular  : mixed
$uncountable  : mixed

Methods

camelize()  : string
Makes a phrase camel case.
decamelize()  : string
Convert a CamelCaps or camelCase string into a sentence case string
humanize()  : string
Makes an underscored or dashed phrase human-reable.
numPlural()  : mixed
Pluralises a number and word combination, e.g. [1, 'pig'] => '1 pig'; [0, 'pig'] => '0 pigs'
plural()  : string
Makes a singular word plural.
singular()  : string
Makes a plural word singular.
title()  : string
Makes an underscored or dashed or CamelCase phrase human-reable.
uncountable()  : bool
Checks if a word is defined as uncountable.
underscore()  : string
Makes a phrase underscored instead of spaced.

Properties

$cache

protected static mixed $cache = array()

$irregular

protected static mixed $irregular

$uncountable

protected static mixed $uncountable

Methods

camelize()

Makes a phrase camel case.

public static camelize(string $str) : string
Parameters
$str : string

Phrase to camelize

Return values
string

decamelize()

Convert a CamelCaps or camelCase string into a sentence case string

public static decamelize(string $str) : string
Parameters
$str : string
Return values
string

humanize()

Makes an underscored or dashed phrase human-reable.

public static humanize(string $str) : string
Parameters
$str : string

phrase to make human-reable

Return values
string

numPlural()

Pluralises a number and word combination, e.g. [1, 'pig'] => '1 pig'; [0, 'pig'] => '0 pigs'

public static numPlural(int $num, string $word) : mixed
Parameters
$num : int

The number in question

$word : string

The word to pluralise if $num is not 1

plural()

Makes a singular word plural.

public static plural(string $str[, int|null $count = null ]) : string
Parameters
$str : string

Word to pluralize

$count : int|null = null
Return values
string

singular()

Makes a plural word singular.

public static singular(string $str[, int|null $count = null ]) : string
Parameters
$str : string

Word to singularize

$count : int|null = null

Number of things

Return values
string

title()

Makes an underscored or dashed or CamelCase phrase human-reable.

public static title(string $str) : string
Parameters
$str : string

phrase to make human-reable

Return values
string

uncountable()

Checks if a word is defined as uncountable.

public static uncountable(string $str) : bool
Parameters
$str : string

Word to check

Return values
bool

underscore()

Makes a phrase underscored instead of spaced.

public static underscore(string $str) : string
Parameters
$str : string

Phrase to underscore

Return values
string
On this page

Search results