Passed
Push — master ( b97787...c0f601 )
by Jean-Christophe
16:10
created

MessagesCatalog::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 4
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Ubiquity\translation;
4
5
use Ubiquity\translation\loader\LoaderInterface;
6
7
/**
8
 * Catalog of translation messages associated to a locale.
9
 * Ubiquity\translation$MessagesCatalog
10
 * This class is part of Ubiquity
11
 *
12
 * @author jcheron <[email protected]>
13
 * @version 1.0.0
14
 *
15
 */
16
class MessagesCatalog {
17
	protected $messagesDomains;
18
	/**
19
	 *
20
	 * @var LoaderInterface
21
	 */
22
	protected $loader;
23
	protected $locale;
24
25 1
	public function __construct($locale, LoaderInterface $loader) {
26 1
		$this->locale = $locale;
27 1
		$this->loader = $loader;
28 1
		$this->messagesDomains = [ ];
29 1
	}
30
31 1
	public function load() {
32 1
		$this->messagesDomains = [ ];
33 1
		$domains = $this->getDomains ();
34 1
		foreach ( $domains as $domain ) {
35 1
			$do = new MessagesDomain ( $this->locale, $this->loader, $domain );
36 1
			$do->load ();
37 1
			$this->messagesDomains [] = $do;
38
		}
39 1
	}
40
41 1
	public function getDomains() {
42 1
		return $this->loader->getDomains ( $this->locale );
43
	}
44
45
	/**
46
	 *
47
	 * @return MessagesDomain[]
48
	 */
49 1
	public function getMessagesDomains() {
50 1
		return $this->messagesDomains;
51
	}
52
}
53
54