Inflectible::getIrregular()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 7
ccs 6
cts 6
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Inflector\Rules\Spanish;
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 73
    public static function getSingular() : iterable
18
    {
19 73
        yield new Transformation(new Pattern('/ereses$/'), 'erés');
0 ignored issues
show
Bug Best Practice introduced by
The expression yield new Doctrine\Infle...('/ereses$/'), 'erés') returns the type Generator which is incompatible with the documented return type Doctrine\Inflector\Rules\Transformation[].
Loading history...
20 73
        yield new Transformation(new Pattern('/iones$/'), 'ión');
21 73
        yield new Transformation(new Pattern('/ces$/'), 'z');
22 73
        yield new Transformation(new Pattern('/es$/'), '');
23 73
        yield new Transformation(new Pattern('/s$/'), '');
24 73
    }
25
26
    /**
27
     * @return Transformation[]
28
     */
29 73
    public static function getPlural() : iterable
30
    {
31 73
        yield new Transformation(new Pattern('/ú([sn])$/i'), 'u\1es');
0 ignored issues
show
Bug Best Practice introduced by
The expression yield new Doctrine\Infle...ú([sn])$/i'), 'u\1es') returns the type Generator which is incompatible with the documented return type Doctrine\Inflector\Rules\Transformation[].
Loading history...
32 73
        yield new Transformation(new Pattern('/ó([sn])$/i'), 'o\1es');
33 73
        yield new Transformation(new Pattern('/í([sn])$/i'), 'i\1es');
34 73
        yield new Transformation(new Pattern('/é([sn])$/i'), 'e\1es');
35 73
        yield new Transformation(new Pattern('/á([sn])$/i'), 'a\1es');
36 73
        yield new Transformation(new Pattern('/z$/i'), 'ces');
37 73
        yield new Transformation(new Pattern('/([aeiou]s)$/i'), '\1');
38 73
        yield new Transformation(new Pattern('/([^aeéiou])$/i'), '\1es');
39 73
        yield new Transformation(new Pattern('/$/'), 's');
40 73
    }
41
42
    /**
43
     * @return Substitution[]
44
     */
45 73
    public static function getIrregular() : iterable
46
    {
47 73
        yield new Substitution(new Word('el'), new Word('los'));
0 ignored issues
show
Bug Best Practice introduced by
The expression yield new Doctrine\Infle...ctor\Rules\Word('los')) returns the type Generator which is incompatible with the documented return type Doctrine\Inflector\Rules\Substitution[].
Loading history...
48 73
        yield new Substitution(new Word('papá'), new Word('papás'));
49 73
        yield new Substitution(new Word('mamá'), new Word('mamás'));
50 73
        yield new Substitution(new Word('sofá'), new Word('sofás'));
51 73
        yield new Substitution(new Word('mes'), new Word('meses'));
52 73
    }
53
}
54