1 | <?php |
||
7 | class Pluralizer |
||
8 | { |
||
9 | /** |
||
10 | * Uncountable word forms. |
||
11 | * |
||
12 | * @var array |
||
13 | */ |
||
14 | public static $uncountable = [ |
||
15 | 'audio', |
||
16 | 'bison', |
||
17 | 'cattle', |
||
18 | 'chassis', |
||
19 | 'compensation', |
||
20 | 'coreopsis', |
||
21 | 'data', |
||
22 | 'deer', |
||
23 | 'education', |
||
24 | 'emoji', |
||
25 | 'equipment', |
||
26 | 'evidence', |
||
27 | 'feedback', |
||
28 | 'firmware', |
||
29 | 'fish', |
||
30 | 'furniture', |
||
31 | 'gold', |
||
32 | 'hardware', |
||
33 | 'information', |
||
34 | 'jedi', |
||
35 | 'kin', |
||
36 | 'knowledge', |
||
37 | 'love', |
||
38 | 'metadata', |
||
39 | 'money', |
||
40 | 'moose', |
||
41 | 'news', |
||
42 | 'nutrition', |
||
43 | 'offspring', |
||
44 | 'plankton', |
||
45 | 'pokemon', |
||
46 | 'police', |
||
47 | 'rain', |
||
48 | 'recommended', |
||
49 | 'related', |
||
50 | 'rice', |
||
51 | 'series', |
||
52 | 'sheep', |
||
53 | 'software', |
||
54 | 'species', |
||
55 | 'swine', |
||
56 | 'traffic', |
||
57 | 'wheat', |
||
58 | ]; |
||
59 | |||
60 | /** |
||
61 | * Get the plural form of an English word. |
||
62 | * |
||
63 | * @param string $value |
||
64 | * @param int $count |
||
65 | * @return string |
||
66 | */ |
||
67 | 1 | public static function plural($value, $count = 2) |
|
77 | |||
78 | /** |
||
79 | * Get the singular form of an English word. |
||
80 | * |
||
81 | * @param string $value |
||
82 | * @return string |
||
83 | */ |
||
84 | 1 | public static function singular($value) |
|
90 | |||
91 | /** |
||
92 | * Determine if the given value is uncountable. |
||
93 | * |
||
94 | * @param string $value |
||
95 | * @return bool |
||
96 | */ |
||
97 | 1 | protected static function uncountable($value) |
|
101 | |||
102 | /** |
||
103 | * Attempt to match the case on two strings. |
||
104 | * |
||
105 | * @param string $value |
||
106 | * @param string $comparison |
||
107 | * @return string |
||
108 | */ |
||
109 | 1 | protected static function matchCase($value, $comparison) |
|
121 | } |
||
122 |