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

Plurality   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 8
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
B pluralize() 0 14 8
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