Completed
Pull Request — master (#71)
by
unknown
01:22
created

Entry::getReference()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Sepia\PoParser\Catalog;
4
5
class Entry
6
{
7
    /** @var string */
8
    protected $msgId;
9
10
    /** @var string */
11
    protected $msgStr;
12
13
    /** @var string */
14
    protected $msgIdPlural;
15
16
    /** @var string[] */
17
    protected $msgStrPlurals;
18
19
    /** @var string|null */
20
    protected $msgCtxt;
21
22
    /** @var Entry|null */
23
    protected $previousEntry;
24
25
    /** @var bool */
26
    protected $obsolete;
27
28
    /** @var array */
29
    protected $flags;
30
31
    /** @var array */
32
    protected $translatorComments;
33
34
    /** @var array */
35
    protected $developerComments;
36
37
    /** @var array */
38
    protected $reference;
39
40
    /**
41
     * @param string $msgId
42
     * @param string $msgStr
43
     */
44
    public function __construct($msgId, $msgStr = null)
45
    {
46
        $this->msgId = $msgId;
47
        $this->msgStr = $msgStr;
48
        $this->flags = array();
49
        $this->translatorComments = array();
50
        $this->developerComments = array();
51
        $this->reference = array();
52
    }
53
54
    /**
55
     * @param string $msgId
56
     *
57
     * @return Entry
58
     */
59
    public function setMsgId($msgId)
60
    {
61
        $this->msgId = $msgId;
62
63
        return $this;
64
    }
65
66
    /**
67
     * @param string $msgStr
68
     *
69
     * @return Entry
70
     */
71
    public function setMsgStr($msgStr)
72
    {
73
        $this->msgStr = $msgStr;
74
75
        return $this;
76
    }
77
78
    /**
79
     * @param string $msgIdPlural
80
     *
81
     * @return Entry
82
     */
83
    public function setMsgIdPlural($msgIdPlural)
84
    {
85
        $this->msgIdPlural = $msgIdPlural;
86
87
        return $this;
88
    }
89
90
    /**
91
     * @param string $msgCtxt
92
     *
93
     * @return Entry
94
     */
95
    public function setMsgCtxt($msgCtxt)
96
    {
97
        $this->msgCtxt = $msgCtxt;
98
99
        return $this;
100
    }
101
102
    /**
103
     * @param null|Entry $previousEntry
104
     *
105
     * @return Entry
106
     */
107
    public function setPreviousEntry($previousEntry)
108
    {
109
        $this->previousEntry = $previousEntry;
110
111
        return $this;
112
    }
113
114
    /**
115
     * @param bool $obsolete
116
     *
117
     * @return Entry
118
     */
119
    public function setObsolete($obsolete)
120
    {
121
        $this->obsolete = $obsolete;
122
123
        return $this;
124
    }
125
126
    /**
127
     * @param array $flags
128
     *
129
     * @return Entry
130
     */
131
    public function setFlags($flags)
132
    {
133
        $this->flags = $flags;
134
135
        return $this;
136
    }
137
138
    /**
139
     * @param array $translatorComments
140
     *
141
     * @return Entry
142
     */
143
    public function setTranslatorComments($translatorComments)
144
    {
145
        $this->translatorComments = $translatorComments;
146
147
        return $this;
148
    }
149
150
    /**
151
     * @param array $developerComments
152
     *
153
     * @return Entry
154
     */
155
    public function setDeveloperComments($developerComments)
156
    {
157
        $this->developerComments = $developerComments;
158
159
        return $this;
160
    }
161
162
    /**
163
     * @param array $reference
164
     *
165
     * @return Entry
166
     */
167
    public function setReference($reference)
168
    {
169
        $this->reference = $reference;
170
171
        return $this;
172
    }
173
174
    /**
175
     * @param string[] $msgStrPlurals
176
     *
177
     * @return Entry
178
     */
179
    public function setMsgStrPlurals($msgStrPlurals)
180
    {
181
        $this->msgStrPlurals = $msgStrPlurals;
182
183
        return $this;
184
    }
185
186
    /**
187
     * @return string
188
     */
189
    public function getMsgId()
190
    {
191
        return $this->msgId;
192
    }
193
194
    /**
195
     * @return string
196
     */
197
    public function getMsgStr()
198
    {
199
        return $this->msgStr;
200
    }
201
202
    /**
203
     * @return string
204
     */
205
    public function getMsgIdPlural()
206
    {
207
        return $this->msgIdPlural;
208
    }
209
210
    /**
211
     * @return string|null
212
     */
213
    public function getMsgCtxt()
214
    {
215
        return $this->msgCtxt;
216
    }
217
218
    /**
219
     * @return null|Entry
220
     */
221
    public function getPreviousEntry()
222
    {
223
        return $this->previousEntry;
224
    }
225
226
    /**
227
     * @return bool
228
     */
229
    public function isObsolete()
230
    {
231
        return $this->obsolete === true;
232
    }
233
234
    /**
235
     * @return bool
236
     */
237
    public function isFuzzy()
238
    {
239
        return in_array('fuzzy', $this->getFlags(), true);
240
    }
241
242
    /**
243
     * @return bool
244
     */
245
    public function isPlural()
246
    {
247
        return $this->getMsgIdPlural() !== null || $this->getMsgStrPlurals() !== null;
248
    }
249
250
    /**
251
     * @return array
252
     */
253
    public function getFlags()
254
    {
255
        return $this->flags;
256
    }
257
258
    /**
259
     * @return array
260
     */
261
    public function getTranslatorComments()
262
    {
263
        return $this->translatorComments;
264
    }
265
266
    /**
267
     * @return array
268
     */
269
    public function getDeveloperComments()
270
    {
271
        return $this->developerComments;
272
    }
273
274
    /**
275
     * @return array
276
     */
277
    public function getReference()
278
    {
279
        return $this->reference;
280
    }
281
282
    /**
283
     * @return string[]
284
     */
285
    public function getMsgStrPlurals()
286
    {
287
        return $this->msgStrPlurals;
288
    }
289
}
290