PluralRuleTagalog   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A plurals() 0 4 1
A plural() 0 10 4
1
<?php namespace Fisharebest\Localization\PluralRule;
2
3
/**
4
 * Class PluralRuleTagalog - Select a plural form for a specified number.
5
 * nplurals=2; plural=n % 10 != 4 && n%10 != 6 && n%10 != 9;
6
 *
7
 * @author    Greg Roach <[email protected]>
8
 * @copyright (c) 2018 Greg Roach
9
 * @license   GPLv3+
10
 */
11
class PluralRuleTagalog implements PluralRuleInterface
12
{
13
    public function plurals()
14
    {
15
        return 2;
16
    }
17
18
    public function plural($number)
19
    {
20
        $number = abs($number);
21
22
        if ($number % 10 === 4 || $number % 10 === 6 || $number % 10 === 9) {
23
            return 1;
24
        } else {
25
            return 0;
26
        }
27
    }
28
}
29