Total Complexity | 6 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
8 | final class BoogieSingularizer implements Singularizer |
||
9 | { |
||
10 | /** @var Inflector[] */ |
||
11 | private $inflectors; |
||
12 | |||
13 | private const LANGUAGES = [ |
||
14 | 'english' => 'en', |
||
15 | 'french' => 'fr', |
||
16 | 'norwegian bokmal' => 'nb', |
||
17 | 'bokmal' => 'nb', |
||
18 | 'portuguese' => 'pt', |
||
19 | 'spanish' => 'es', |
||
20 | 'turkish' => 'tr', |
||
21 | ]; |
||
22 | |||
23 | public function __construct(Inflector ...$inflectors) |
||
24 | { |
||
25 | $this->inflectors = $inflectors; |
||
26 | } |
||
27 | |||
28 | public static function default(): Singularizer |
||
31 | } |
||
32 | |||
33 | public static function in(string $locale): Singularizer |
||
34 | { |
||
35 | return new self( |
||
36 | Inflector::get( |
||
37 | self::LANGUAGES[strtolower($locale)] ?? strtolower($locale) |
||
38 | ), |
||
39 | Inflector::get('en') |
||
40 | ); |
||
41 | } |
||
42 | |||
43 | public function convert(string $word): string |
||
52 | } |
||
53 | } |
||
54 |