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

MessagesDomain::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 2
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Ubiquity\translation;
4
5
use Ubiquity\translation\loader\LoaderInterface;
6
7
/**
8
 * Represents a list of messages in a domain for a locale.
9
 * Ubiquity\translation$MessagesDomain
10
 * This class is part of Ubiquity
11
 *
12
 * @author jcheron <[email protected]>
13
 * @version 1.0.0
14
 *
15
 */
16
class MessagesDomain {
17
	protected $messages;
18
	protected $loader;
19
	protected $locale;
20
	protected $domain;
21
22 1
	public function __construct($locale=null, LoaderInterface $loader=null, $domain=null) {
23 1
		$this->locale = $locale;
24 1
		$this->loader = $loader;
25 1
		$this->domain = $domain;
26 1
	}
27
28
	/**
29
	 *
30
	 * @return mixed
31
	 */
32 1
	public function getMessages() {
33 1
		return $this->messages;
34
	}
35
36
	/**
37
	 *
38
	 * @return mixed
39
	 */
40
	public function getLoader() {
41
		return $this->loader;
42
	}
43
44
	/**
45
	 *
46
	 * @return mixed
47
	 */
48
	public function getLocale() {
49
		return $this->locale;
50
	}
51
52
	/**
53
	 *
54
	 * @param mixed $messages
55
	 */
56 1
	public function setMessages($messages) {
57 1
		$this->messages = $messages;
58 1
	}
59
60
	/**
61
	 *
62
	 * @param mixed $loader
63
	 */
64
	public function setLoader($loader) {
65
		$this->loader = $loader;
66
	}
67
68
	/**
69
	 *
70
	 * @param mixed $locale
71
	 */
72
	public function setLocale($locale) {
73
		$this->locale = $locale;
74
	}
75
76 1
	public function store() {
77 1
		$this->loader->save ( $this->messages, $this->locale, $this->domain );
1 ignored issue
show
Bug introduced by
The method save() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

77
		$this->loader->/** @scrutinizer ignore-call */ 
78
                 save ( $this->messages, $this->locale, $this->domain );

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
78 1
	}
79
80 1
	public function load() {
81 1
		$this->messages = $this->loader->loadDomain ( $this->locale, $this->domain );
82 1
	}
83
	/**
84
	 * @return string
85
	 */
86 1
	public function getDomain() {
87 1
		return $this->domain;
88
	}
89
90
}
91
92