Passed
Push — master ( a02cde...eb9e44 )
by Jean-Christophe
09:52
created

Translator   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 48
ccs 0
cts 30
cp 0
rs 10
c 0
b 0
f 0
wmc 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A setRootDir() 0 2 1
A setLocale() 0 2 1
A clearCache() 0 2 1
A loadCatalogue() 0 2 1
A getFallbackLocale() 0 2 1
A getLocale() 0 2 1
A __construct() 0 3 1
A trans() 0 2 1
A getCatalogue() 0 2 1
A setFallbackLocale() 0 2 1
1
<?php
2
3
namespace Ubiquity\translation;
4
5
/**
6
 * Injectable translator (to use with di)
7
 * @author jcheron <[email protected]>
8
 * @version 1.0.1
9
 */
10
class Translator {
11
	private $manager;
12
	
13
	public function __construct($locale="en_EN",$fallbackLocale=null,$rootDir=null){
14
		$this->manager=new TranslatorManager();
15
		$this->manager->start($locale,$fallbackLocale,$rootDir);
16
	}
17
	
18
	public function setLocale($locale){
19
		$this->manager->setLocale($locale);
20
	}
21
	
22
	public function setRootDir($rootDir=null){
23
		$this->manager->setRootDir($rootDir);
24
	}
25
	
26
	public function getLocale(){
27
		return $this->manager->getLocale();
28
	}
29
	
30
	public function trans($id, array $parameters = array(), $domain = null, $locale = null){
31
		return $this->manager->trans($id,$parameters,$domain,$locale);
32
	}
33
	
34
	public function getCatalogue(&$locale = null){
35
		return $this->manager->getCatalogue($locale);
36
	}
37
	
38
	public function loadCatalogue($locale = null){
39
		$this->manager->loadCatalogue($locale);
40
	}
41
	
42
	/**
43
	 * @return mixed
44
	 */
45
	public function getFallbackLocale() {
46
		return $this->manager->getFallbackLocale();
47
	}
48
	
49
	/**
50
	 * @param mixed $fallbackLocale
51
	 */
52
	public function setFallbackLocale($fallbackLocale) {
53
		$this->manager->setFallbackLocale($fallbackLocale);
54
	}
55
	
56
	public function clearCache(){
57
		$this->manager->clearCache();
58
	}
59
}
60
61