Lithuanian::decide()   B
last analyzed

Complexity

Conditions 7
Paths 11

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
rs 8.8333
c 0
b 0
f 0
cc 7
nc 11
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Polyglot\Pluralization\Rules;
6
7
/**
8
 * @package Polyglot/Pluralization/Rules
9
 * @author  Mihai MATEI <[email protected]>
10
 */
11
class Lithuanian implements RuleInterface
12
{
13
    /**
14
     * @inheritDoc
15
     */
16
    public function decide(int $n): int
17
    {
18
        if ($n % 10 === 1 && $n % 100 !== 11) {
19
            return 0;
20
        }
21
22
        return $n % 10 >= 2 && $n % 10 <= 9 && ($n % 100 < 11 || $n % 100 > 19) ? 1 : 2;
23
    }
24
}