forked from OblikStudio/php-pluralization
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMacedonianLanguage.php
51 lines (45 loc) · 1.16 KB
/
MacedonianLanguage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
namespace Oblik\Pluralization;
class MacedonianLanguage extends Language
{
static function cardinal(float $n, int $i, int $v, int $w, int $f, int $t)
{
$imod10 = $i % 10;
$imod100 = $i % 100;
$fmod10 = $f % 10;
$fmod100 = $f % 100;
if (
($v == 0 && $imod10 == 1 && $imod100 != 11)
|| ($fmod10 == 1 && $fmod100 != 11)
) {
return ONE;
}
return OTHER;
}
static function ordinal(int $n)
{
$mod10 = $n % 10;
$mod100 = $n % 100;
if ($mod10 == 1 && $mod100 != 11) {
return ONE;
}
elseif ($mod10 == 2 && $mod100 != 12) {
return TWO;
}
elseif (($mod10 == 7 || $mod10 == 8) && ($mod100 != 17 && $mod100 != 18)) {
return MANY;
}
return OTHER;
}
const RANGE = [
ZERO . ZERO => OTHER,
ZERO . ONE => ONE,
ZERO . OTHER => OTHER,
ONE . ZERO => OTHER,
ONE . ONE => ONE,
ONE . OTHER => OTHER,
OTHER . ZERO => OTHER,
OTHER . ONE => ONE,
OTHER . OTHER => OTHER,
];
}