MonolingualMonthNameProvider::getMonthNumbers()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace ValueParsers;
4
5
/**
6
 * A monolingual month name and month number provider, based on a static array.
7
 *
8
 * @since 0.8.4
9
 *
10
 * @license GPL-2.0+
11
 * @author Thiemo Kreuz
12
 */
13
class MonolingualMonthNameProvider implements MonthNameProvider {
14
15
	/**
16
	 * @var string[]
17
	 */
18
	private $monthNames;
19
20
	/**
21
	 * @param string[] $monthNames Array mapping month numbers (1 to 12) to localized month names.
22
	 */
23 2
	public function __construct( array $monthNames ) {
24 2
		$this->monthNames = $monthNames;
25 2
	}
26
27
	/**
28
	 * @param string $languageCode Ignored in this implementation.
29
	 *
30
	 * @return string[] Array mapping month numbers (1 to 12) to localized month names.
31
	 */
32 1
	public function getLocalizedMonthNames( $languageCode ) {
33 1
		return $this->monthNames;
34
	}
35
36
	/**
37
	 * @param string $languageCode Ignored in this implementation.
38
	 *
39
	 * @return int[] Array mapping localized month names to month numbers (1 to 12).
40
	 */
41 1
	public function getMonthNumbers( $languageCode ) {
42 1
		return array_flip( $this->monthNames );
43
	}
44
45
}
46