Failed Conditions
Pull Request — master (#97)
by Jonathan
02:10
created

Plural   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 119
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 119
ccs 103
cts 103
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
B getIrregular() 0 65 1
A getUninflected() 0 12 1
A getTransformations() 0 27 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Inflector\Rules\English;
6
7
use Doctrine\Inflector\Rules\Pattern;
8
use Doctrine\Inflector\Rules\Substitution;
9
use Doctrine\Inflector\Rules\Transformation;
10
use Doctrine\Inflector\Rules\Word;
11
12
class Plural
13
{
14
    /**
15
     * @return Transformation[]
16
     */
17 524
    public static function getTransformations() : iterable
18
    {
19 524
        yield new Transformation(new Pattern('(s)tatus$'), '\1\2tatuses');
20 524
        yield new Transformation(new Pattern('(quiz)$'), '\1zes');
21 524
        yield new Transformation(new Pattern('^(ox)$'), '\1\2en');
22 524
        yield new Transformation(new Pattern('([m|l])ouse$'), '\1ice');
23 524
        yield new Transformation(new Pattern('(matr|vert|ind)(ix|ex)$'), '\1ices');
24 524
        yield new Transformation(new Pattern('(x|ch|ss|sh)$'), '\1es');
25 524
        yield new Transformation(new Pattern('([^aeiouy]|qu)y$'), '\1ies');
26 524
        yield new Transformation(new Pattern('(hive|gulf)$'), '\1s');
27 524
        yield new Transformation(new Pattern('(?:([^f])fe|([lr])f)$'), '\1\2ves');
28 524
        yield new Transformation(new Pattern('sis$'), 'ses');
29 524
        yield new Transformation(new Pattern('([ti])um$'), '\1a');
30 524
        yield new Transformation(new Pattern('(tax)on$'), '\1a');
31 524
        yield new Transformation(new Pattern('(c)riterion$'), '\1riteria');
32 524
        yield new Transformation(new Pattern('(p)erson$'), '\1eople');
33 524
        yield new Transformation(new Pattern('(m)an$'), '\1en');
34 524
        yield new Transformation(new Pattern('(c)hild$'), '\1hildren');
35 524
        yield new Transformation(new Pattern('(f)oot$'), '\1eet');
36 524
        yield new Transformation(new Pattern('(buffal|her|potat|tomat|volcan)o$'), '\1\2oes');
37 524
        yield new Transformation(new Pattern('(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|vir)us$'), '\1i');
38 524
        yield new Transformation(new Pattern('us$'), 'uses');
39 524
        yield new Transformation(new Pattern('(alias)$'), '\1es');
40 524
        yield new Transformation(new Pattern('(analys|ax|cris|test|thes)is$'), '\1es');
41 524
        yield new Transformation(new Pattern('s$'), 's');
42 524
        yield new Transformation(new Pattern('^$'), '');
43 524
        yield new Transformation(new Pattern('$'), 's');
44 524
    }
45
46
    /**
47
     * @return Pattern[]
48
     */
49 524
    public static function getUninflected() : iterable
50
    {
51 524
        yield new Pattern('.*[nrlm]ese');
52 524
        yield new Pattern('.*deer');
53 524
        yield new Pattern('.*fish');
54 524
        yield new Pattern('.*measles');
55 524
        yield new Pattern('.*ois');
56 524
        yield new Pattern('.*pox');
57 524
        yield new Pattern('.*sheep');
58 524
        yield new Pattern('people');
59 524
        yield new Pattern('police');
60 524
        yield new Pattern('middleware');
61 524
    }
62
63
    /**
64
     * @return Substitution[]
65
     */
66 526
    public static function getIrregular() : iterable
67
    {
68 526
        yield new Substitution(new Word('atlas'), new Word('atlases'));
69 526
        yield new Substitution(new Word('axe'), new Word('axes'));
70 526
        yield new Substitution(new Word('beef'), new Word('beefs'));
71 526
        yield new Substitution(new Word('brother'), new Word('brothers'));
72 526
        yield new Substitution(new Word('cafe'), new Word('cafes'));
73 526
        yield new Substitution(new Word('chateau'), new Word('chateaux'));
74 526
        yield new Substitution(new Word('niveau'), new Word('niveaux'));
75 526
        yield new Substitution(new Word('child'), new Word('children'));
76 526
        yield new Substitution(new Word('cookie'), new Word('cookies'));
77 526
        yield new Substitution(new Word('corpus'), new Word('corpuses'));
78 526
        yield new Substitution(new Word('cow'), new Word('cows'));
79 526
        yield new Substitution(new Word('criterion'), new Word('criteria'));
80 526
        yield new Substitution(new Word('curriculum'), new Word('curricula'));
81 526
        yield new Substitution(new Word('demo'), new Word('demos'));
82 526
        yield new Substitution(new Word('domino'), new Word('dominoes'));
83 526
        yield new Substitution(new Word('echo'), new Word('echoes'));
84 526
        yield new Substitution(new Word('foot'), new Word('feet'));
85 526
        yield new Substitution(new Word('fungus'), new Word('fungi'));
86 526
        yield new Substitution(new Word('ganglion'), new Word('ganglions'));
87 526
        yield new Substitution(new Word('genie'), new Word('genies'));
88 526
        yield new Substitution(new Word('genus'), new Word('genera'));
89 526
        yield new Substitution(new Word('goose'), new Word('geese'));
90 526
        yield new Substitution(new Word('graffito'), new Word('graffiti'));
91 526
        yield new Substitution(new Word('hippopotamus'), new Word('hippopotami'));
92 526
        yield new Substitution(new Word('hoof'), new Word('hoofs'));
93 526
        yield new Substitution(new Word('human'), new Word('humans'));
94 526
        yield new Substitution(new Word('iris'), new Word('irises'));
95 526
        yield new Substitution(new Word('larva'), new Word('larvae'));
96 526
        yield new Substitution(new Word('leaf'), new Word('leaves'));
97 526
        yield new Substitution(new Word('loaf'), new Word('loaves'));
98 526
        yield new Substitution(new Word('man'), new Word('men'));
99 526
        yield new Substitution(new Word('medium'), new Word('media'));
100 526
        yield new Substitution(new Word('memorandum'), new Word('memoranda'));
101 526
        yield new Substitution(new Word('money'), new Word('monies'));
102 526
        yield new Substitution(new Word('mongoose'), new Word('mongooses'));
103 526
        yield new Substitution(new Word('motto'), new Word('mottoes'));
104 526
        yield new Substitution(new Word('move'), new Word('moves'));
105 526
        yield new Substitution(new Word('mythos'), new Word('mythoi'));
106 526
        yield new Substitution(new Word('niche'), new Word('niches'));
107 526
        yield new Substitution(new Word('nucleus'), new Word('nuclei'));
108 526
        yield new Substitution(new Word('numen'), new Word('numina'));
109 526
        yield new Substitution(new Word('occiput'), new Word('occiputs'));
110 526
        yield new Substitution(new Word('octopus'), new Word('octopuses'));
111 526
        yield new Substitution(new Word('opus'), new Word('opuses'));
112 526
        yield new Substitution(new Word('ox'), new Word('oxen'));
113 526
        yield new Substitution(new Word('passerby'), new Word('passersby'));
114 526
        yield new Substitution(new Word('penis'), new Word('penises'));
115 526
        yield new Substitution(new Word('person'), new Word('people'));
116 526
        yield new Substitution(new Word('plateau'), new Word('plateaux'));
117 526
        yield new Substitution(new Word('runner-up'), new Word('runners-up'));
118 526
        yield new Substitution(new Word('safe'), new Word('safes'));
119 526
        yield new Substitution(new Word('sex'), new Word('sexes'));
120 526
        yield new Substitution(new Word('soliloquy'), new Word('soliloquies'));
121 526
        yield new Substitution(new Word('son-in-law'), new Word('sons-in-law'));
122 526
        yield new Substitution(new Word('syllabus'), new Word('syllabi'));
123 526
        yield new Substitution(new Word('testis'), new Word('testes'));
124 526
        yield new Substitution(new Word('thief'), new Word('thieves'));
125 526
        yield new Substitution(new Word('tooth'), new Word('teeth'));
126 526
        yield new Substitution(new Word('tornado'), new Word('tornadoes'));
127 526
        yield new Substitution(new Word('trilby'), new Word('trilbys'));
128 526
        yield new Substitution(new Word('turf'), new Word('turfs'));
129 526
        yield new Substitution(new Word('valve'), new Word('valves'));
130 526
        yield new Substitution(new Word('volcano'), new Word('volcanoes'));
131 526
    }
132
}
133