PluralRule15   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
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 3
1
<?php namespace Fisharebest\Localization\PluralRule;
2
3
/**
4
 * Class PluralRule15 - Select a plural form for a specified number.
5
 * Families:
6
 * Icelandic
7
 *
8
 * @author    Greg Roach <[email protected]>
9
 * @copyright (c) 2018 Greg Roach
10
 * @license   GPLv3+
11
 */
12
class PluralRule15 implements PluralRuleInterface
13
{
14
    public function plurals()
15
    {
16
        return 2;
17
    }
18
19
    public function plural($number)
20
    {
21
        $number = abs($number);
22
23
        if ($number % 10 !== 1 || $number % 100 === 11) {
24
            return 1;
25
        } else {
26
            return 0;
27
        }
28
    }
29
}
30