2021-05-10 00:23:30 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare (strict_types=1);
|
2021-11-12 09:48:23 +00:00
|
|
|
namespace RectorPrefix20211112\Doctrine\Inflector;
|
2021-05-10 00:23:30 +00:00
|
|
|
|
2021-11-12 09:48:23 +00:00
|
|
|
use RectorPrefix20211112\Doctrine\Inflector\Rules\English;
|
|
|
|
use RectorPrefix20211112\Doctrine\Inflector\Rules\French;
|
|
|
|
use RectorPrefix20211112\Doctrine\Inflector\Rules\NorwegianBokmal;
|
|
|
|
use RectorPrefix20211112\Doctrine\Inflector\Rules\Portuguese;
|
|
|
|
use RectorPrefix20211112\Doctrine\Inflector\Rules\Spanish;
|
|
|
|
use RectorPrefix20211112\Doctrine\Inflector\Rules\Turkish;
|
2021-05-10 00:23:30 +00:00
|
|
|
use InvalidArgumentException;
|
|
|
|
use function sprintf;
|
|
|
|
final class InflectorFactory
|
|
|
|
{
|
2021-11-12 09:48:23 +00:00
|
|
|
public static function create() : \RectorPrefix20211112\Doctrine\Inflector\LanguageInflectorFactory
|
2021-05-10 00:23:30 +00:00
|
|
|
{
|
2021-11-12 09:48:23 +00:00
|
|
|
return self::createForLanguage(\RectorPrefix20211112\Doctrine\Inflector\Language::ENGLISH);
|
2021-05-10 00:23:30 +00:00
|
|
|
}
|
2021-11-12 09:48:23 +00:00
|
|
|
public static function createForLanguage(string $language) : \RectorPrefix20211112\Doctrine\Inflector\LanguageInflectorFactory
|
2021-05-10 00:23:30 +00:00
|
|
|
{
|
|
|
|
switch ($language) {
|
2021-11-12 09:48:23 +00:00
|
|
|
case \RectorPrefix20211112\Doctrine\Inflector\Language::ENGLISH:
|
|
|
|
return new \RectorPrefix20211112\Doctrine\Inflector\Rules\English\InflectorFactory();
|
|
|
|
case \RectorPrefix20211112\Doctrine\Inflector\Language::FRENCH:
|
|
|
|
return new \RectorPrefix20211112\Doctrine\Inflector\Rules\French\InflectorFactory();
|
|
|
|
case \RectorPrefix20211112\Doctrine\Inflector\Language::NORWEGIAN_BOKMAL:
|
|
|
|
return new \RectorPrefix20211112\Doctrine\Inflector\Rules\NorwegianBokmal\InflectorFactory();
|
|
|
|
case \RectorPrefix20211112\Doctrine\Inflector\Language::PORTUGUESE:
|
|
|
|
return new \RectorPrefix20211112\Doctrine\Inflector\Rules\Portuguese\InflectorFactory();
|
|
|
|
case \RectorPrefix20211112\Doctrine\Inflector\Language::SPANISH:
|
|
|
|
return new \RectorPrefix20211112\Doctrine\Inflector\Rules\Spanish\InflectorFactory();
|
|
|
|
case \RectorPrefix20211112\Doctrine\Inflector\Language::TURKISH:
|
|
|
|
return new \RectorPrefix20211112\Doctrine\Inflector\Rules\Turkish\InflectorFactory();
|
2021-05-10 00:23:30 +00:00
|
|
|
default:
|
2021-05-10 22:23:08 +00:00
|
|
|
throw new \InvalidArgumentException(\sprintf('Language "%s" is not supported.', $language));
|
2021-05-10 00:23:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|