Entry   A
last analyzed

Complexity

Total Complexity 26

Size/Duplication

Total Lines 284
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 54
c 1
b 0
f 0
dl 0
loc 284
rs 10
wmc 26

25 Methods

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