Utils
in package
Leaf Db Utils ------------------------- Core utilities for leaf db.
Tags
Table of Contents
Methods
- basicPluralize() : string
- Pluralizes a given singular noun based on common English rules.
- basicSingularize() : string
- Singularizes a given plural noun based on common English rules.
- beginsWith() : string
- Construct search that begins with a phrase in db
- endsWith() : string
- Construct search that ends with a phrase in db
- flatten() : bool
- Flatten multidimensional array into a single array
- includes() : string
- Construct search that includes a phrase in db
- word() : string
- Construct search that begins and ends with a phrase in db
Methods
basicPluralize()
Pluralizes a given singular noun based on common English rules.
public
static basicPluralize(string $singular[, int $count = 2 ]) : string
Parameters
- $singular : string
-
The singular noun.
- $count : int = 2
-
The count determining singular or plural (default is 2).
Return values
string —The pluralized form if count is not 1, otherwise the singular.
basicSingularize()
Singularizes a given plural noun based on common English rules.
public
static basicSingularize(string $plural) : string
Parameters
- $plural : string
-
The plural noun.
Return values
string —The singular form of the noun.
beginsWith()
Construct search that begins with a phrase in db
public
static beginsWith(string $phrase) : string
Parameters
- $phrase : string
-
The phrase to check
Return values
stringendsWith()
Construct search that ends with a phrase in db
public
static endsWith(string $phrase) : string
Parameters
- $phrase : string
-
The phrase to check
Return values
stringflatten()
Flatten multidimensional array into a single array
public
static flatten(array<string|int, mixed> $array[, bool $keys = false ]) : bool
Parameters
- $array : array<string|int, mixed>
-
The array to flatten
- $keys : bool = false
Return values
bool —$keys Use array keys or not
includes()
Construct search that includes a phrase in db
public
static includes(string $phrase) : string
Parameters
- $phrase : string
-
The phrase to check
Return values
stringword()
Construct search that begins and ends with a phrase in db
public
static word(string $beginsWith, string $endsWith) : string
Parameters
- $beginsWith : string
-
The beginning of the phrase to search
- $endsWith : string
-
The end of the phrase to search