class Pluralizer

Constants

protected DEFAULT_UNCOUNTABLE

Default uncountable non-nouns word forms.

Properties

static protected Inflector|null $inflector

The cached inflector instance.

static protected string $language

The language that should be used by the inflector.

static list<string> $uncountable

Uncountable non-nouns word forms.

Methods

static string
plural(string $value, array|Countable|int $count = 2)

Get the plural form of an English word.

static string
singular(string $value)

Get the singular form of an English word.

static bool
uncountable(string $value)

Determine if the given value is uncountable.

static string
matchCase(string $value, string $comparison)

Attempt to match the case on two strings.

static Inflector
inflector()

Get the inflector instance.

static void
useLanguage(string $language)

Specify the language that should be used by the inflector.

static void
flushState()

Flush all static state.

Details

at line 43
static string plural(string $value, array|Countable|int $count = 2)

Get the plural form of an English word.

Parameters

string $value
array|Countable|int $count

Return Value

string

at line 61
static string singular(string $value)

Get the singular form of an English word.

Parameters

string $value

Return Value

string

at line 71
static protected bool uncountable(string $value)

Determine if the given value is uncountable.

Parameters

string $value

Return Value

bool

at line 79
static protected string matchCase(string $value, string $comparison)

Attempt to match the case on two strings.

Parameters

string $value
string $comparison

Return Value

string

at line 95
static Inflector inflector()

Get the inflector instance.

Return Value

Inflector

at line 111
static void useLanguage(string $language)

Specify the language that should be used by the inflector.

Boot-only. The language and inflector instance persist in static properties for the worker lifetime and are used by every Str::plural() / Str::singular() call across all coroutines.

Parameters

string $language

Return Value

void

at line 120
static void flushState()

Flush all static state.

Return Value

void