| 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 |
public static function getSingular(): iterable |
| 16 |
{ |
| 17 |
yield new Transformation(new Pattern('/ereses$/'), 'erés'); |
| 18 |
yield new Transformation(new Pattern('/iones$/'), 'ión'); |
| 19 |
yield new Transformation(new Pattern('/ces$/'), 'z'); |
| 20 |
yield new Transformation(new Pattern('/es$/'), ''); |
| 21 |
yield new Transformation(new Pattern('/s$/'), ''); |
| 22 |
} |
| 23 |
|
| 24 |
|
| 25 |
public static function getPlural(): iterable |
| 26 |
{ |
| 27 |
yield new Transformation(new Pattern('/ú([sn])$/i'), 'u\1es'); |
| 28 |
yield new Transformation(new Pattern('/ó([sn])$/i'), 'o\1es'); |
| 29 |
yield new Transformation(new Pattern('/í([sn])$/i'), 'i\1es'); |
| 30 |
yield new Transformation(new Pattern('/é([sn])$/i'), 'e\1es'); |
| 31 |
yield new Transformation(new Pattern('/á([sn])$/i'), 'a\1es'); |
| 32 |
yield new Transformation(new Pattern('/z$/i'), 'ces'); |
| 33 |
yield new Transformation(new Pattern('/([aeiou]s)$/i'), '\1'); |
| 34 |
yield new Transformation(new Pattern('/([^aeéiou])$/i'), '\1es'); |
| 35 |
yield new Transformation(new Pattern('/$/'), 's'); |
| 36 |
} |
| 37 |
|
| 38 |
|
| 39 |
public static function getIrregular(): iterable |
| 40 |
{ |
| 41 |
yield new Substitution(new Word('el'), new Word('los')); |
| 42 |
yield new Substitution(new Word('papá'), new Word('papás')); |
| 43 |
yield new Substitution(new Word('mamá'), new Word('mamás')); |
| 44 |
yield new Substitution(new Word('sofá'), new Word('sofás')); |
| 45 |
yield new Substitution(new Word('mes'), new Word('meses')); |
| 46 |
} |
| 47 |
} |