updated composer
This commit is contained in:
+37
-7
@@ -18,7 +18,7 @@ final class EnglishInflector implements InflectorInterface
|
||||
*
|
||||
* @see http://english-zone.com/spelling/plurals.html
|
||||
*/
|
||||
private static $pluralMap = [
|
||||
private const PLURAL_MAP = [
|
||||
// First entry: plural suffix, reversed
|
||||
// Second entry: length of plural suffix
|
||||
// Third entry: Whether the suffix may succeed a vocal
|
||||
@@ -61,6 +61,9 @@ final class EnglishInflector implements InflectorInterface
|
||||
// movies (movie)
|
||||
['seivom', 6, true, true, 'movie'],
|
||||
|
||||
// conspectuses (conspectus), prospectuses (prospectus)
|
||||
['sesutcep', 8, true, true, 'pectus'],
|
||||
|
||||
// feet (foot)
|
||||
['teef', 4, true, true, 'foot'],
|
||||
|
||||
@@ -118,6 +121,9 @@ final class EnglishInflector implements InflectorInterface
|
||||
// fees (fee), trees (tree), employees (employee)
|
||||
['see', 3, true, true, 'ee'],
|
||||
|
||||
// edges (edge)
|
||||
['segd', 4, true, true, 'dge'],
|
||||
|
||||
// roses (rose), garages (garage), cassettes (cassette),
|
||||
// waltzes (waltz), heroes (hero), bushes (bush), arches (arch),
|
||||
// shoes (shoe)
|
||||
@@ -138,7 +144,7 @@ final class EnglishInflector implements InflectorInterface
|
||||
*
|
||||
* @see http://english-zone.com/spelling/plurals.html
|
||||
*/
|
||||
private static $singularMap = [
|
||||
private const SINGULAR_MAP = [
|
||||
// First entry: singular suffix, reversed
|
||||
// Second entry: length of singular suffix
|
||||
// Third entry: Whether the suffix may succeed a vocal
|
||||
@@ -226,6 +232,9 @@ final class EnglishInflector implements InflectorInterface
|
||||
// bacteria (bacterium), criteria (criterion), phenomena (phenomenon)
|
||||
['noi', 3, true, true, 'ions'],
|
||||
|
||||
// coupon (coupons)
|
||||
['nop', 3, true, true, 'pons'],
|
||||
|
||||
// seasons (season), treasons (treason), poisons (poison), lessons (lesson)
|
||||
['nos', 3, true, true, 'sons'],
|
||||
|
||||
@@ -261,6 +270,9 @@ final class EnglishInflector implements InflectorInterface
|
||||
// circuses (circus)
|
||||
['suc', 3, true, true, 'cuses'],
|
||||
|
||||
// conspectuses (conspectus), prospectuses (prospectus)
|
||||
['sutcep', 6, true, true, 'pectuses'],
|
||||
|
||||
// fungi (fungus), alumni (alumnus), syllabi (syllabus), radii (radius)
|
||||
['su', 2, true, true, 'i'],
|
||||
|
||||
@@ -304,16 +316,34 @@ final class EnglishInflector implements InflectorInterface
|
||||
/**
|
||||
* A list of words which should not be inflected, reversed.
|
||||
*/
|
||||
private static $uninflected = [
|
||||
private const UNINFLECTED = [
|
||||
'',
|
||||
|
||||
// data
|
||||
'atad',
|
||||
|
||||
// deer
|
||||
'reed',
|
||||
|
||||
// feedback
|
||||
'kcabdeef',
|
||||
|
||||
// fish
|
||||
'hsif',
|
||||
|
||||
// info
|
||||
'ofni',
|
||||
|
||||
// moose
|
||||
'esoom',
|
||||
|
||||
// series
|
||||
'seires',
|
||||
|
||||
// sheep
|
||||
'peehs',
|
||||
|
||||
// species
|
||||
'seiceps',
|
||||
];
|
||||
|
||||
@@ -327,7 +357,7 @@ final class EnglishInflector implements InflectorInterface
|
||||
$pluralLength = \strlen($lowerPluralRev);
|
||||
|
||||
// Check if the word is one which is not inflected, return early if so
|
||||
if (\in_array($lowerPluralRev, self::$uninflected, true)) {
|
||||
if (\in_array($lowerPluralRev, self::UNINFLECTED, true)) {
|
||||
return [$plural];
|
||||
}
|
||||
|
||||
@@ -335,7 +365,7 @@ final class EnglishInflector implements InflectorInterface
|
||||
// The inner loop $j iterates over the characters of the plural suffix
|
||||
// in the plural table to compare them with the characters of the actual
|
||||
// given plural suffix
|
||||
foreach (self::$pluralMap as $map) {
|
||||
foreach (self::PLURAL_MAP as $map) {
|
||||
$suffix = $map[0];
|
||||
$suffixLength = $map[1];
|
||||
$j = 0;
|
||||
@@ -406,7 +436,7 @@ final class EnglishInflector implements InflectorInterface
|
||||
$singularLength = \strlen($lowerSingularRev);
|
||||
|
||||
// Check if the word is one which is not inflected, return early if so
|
||||
if (\in_array($lowerSingularRev, self::$uninflected, true)) {
|
||||
if (\in_array($lowerSingularRev, self::UNINFLECTED, true)) {
|
||||
return [$singular];
|
||||
}
|
||||
|
||||
@@ -414,7 +444,7 @@ final class EnglishInflector implements InflectorInterface
|
||||
// The inner loop $j iterates over the characters of the singular suffix
|
||||
// in the singular table to compare them with the characters of the actual
|
||||
// given singular suffix
|
||||
foreach (self::$singularMap as $map) {
|
||||
foreach (self::SINGULAR_MAP as $map) {
|
||||
$suffix = $map[0];
|
||||
$suffixLength = $map[1];
|
||||
$j = 0;
|
||||
|
||||
Reference in New Issue
Block a user