Completed
Push — 2.1.x ( 7ab7e8 )
by f
23:20
created

Plurality::pluralize()   B

Complexity

Conditions 8
Paths 6

Size

Total Lines 14
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 8
eloc 12
nc 6
nop 3
dl 0
loc 14
rs 7.7777
c 0
b 0
f 0
1
<?php
2
namespace morphos\Russian;
3
4
class Plurality extends \morphos\Plurality implements Cases {
5
	public function pluralize($word, $count, $animateness = false) {
6
		static $plu;
7
		if ($plu === null)
8
			$plu = new GeneralDeclension();
9
		$ending = $count % 10;
10
		if (($count > 20 && $ending == 1) || $count == 1) {
11
			return $word;
12
		} else if (($count > 20 && in_array($ending, range(2, 4))) || in_array($count, range(2, 4))) {
13
			return $plu->getForm($word, $animateness, self::RODIT_2);
14
		} else {
15
			$forms = $plu->pluralizeAllDeclensions($word, $animateness);
16
			return $forms[self::RODIT_2];
17
		}
18
	}
19
}
20