Passed
Push — master ( 989424...9f50f4 )
by Jonathan
29s
created

Inflectible::getPlural()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 8
cts 8
cp 1
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Inflector\Rules\French;
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 Inflectible
13
{
14
    /**
15
     * @return Transformation[]
16
     */
17 72
    public static function getSingular() : iterable
18
    {
19 72
        yield new Transformation(new Pattern('/(b|cor|ém|gemm|soupir|trav|vant|vitr)aux$/'), '\1ail');
20 72
        yield new Transformation(new Pattern('/ails$/'), 'ail');
21 72
        yield new Transformation(new Pattern('/(journ|chev)aux$/'), '\1al');
22 72
        yield new Transformation(new Pattern('/(bijou|caillou|chou|genou|hibou|joujou|pou|au|eu|eau)x$/'), '\1');
23 72
        yield new Transformation(new Pattern('/s$/'), '');
24 72
    }
25
26
    /**
27
     * @return Transformation[]
28
     */
29 72
    public static function getPlural() : iterable
30
    {
31 72
        yield new Transformation(new Pattern('/(s|x|z)$/'), '\1');
32 72
        yield new Transformation(new Pattern('/(b|cor|ém|gemm|soupir|trav|vant|vitr)ail$/'), '\1aux');
33 72
        yield new Transformation(new Pattern('/ail$/'), 'ails');
34 72
        yield new Transformation(new Pattern('/al$/'), 'aux');
35 72
        yield new Transformation(new Pattern('/(bleu|émeu|landau|lieu|pneu|sarrau)$/'), '\1s');
36 72
        yield new Transformation(new Pattern('/(bijou|caillou|chou|genou|hibou|joujou|pou|au|eu|eau)$/'), '\1x');
37 72
        yield new Transformation(new Pattern('/$/'), 's');
38 72
    }
39
40
    /**
41
     * @return Substitution[]
42
     */
43 72
    public static function getIrregular() : iterable
44
    {
45 72
        yield new Substitution(new Word('monsieur'), new Word('messieurs'));
46 72
        yield new Substitution(new Word('madame'), new Word('mesdames'));
47 72
        yield new Substitution(new Word('mademoiselle'), new Word('mesdemoiselles'));
48 72
    }
49
}
50