Completed
Push — master ( caad37...82c5ce )
by Dmitriy
06:13
created

ModelSingle::getIsGroup()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Yandex\Market\Content\Models;
4
5
use Yandex\Market\Content\Models\Base\MarketModel;
6
7 View Code Duplication
class ModelSingle extends MarketModel
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9
    protected $offersCount = null;
10
11
    protected $rating = null;
12
13
    protected $reviewsCount = null;
14
15
    protected $articlesCount = null;
16
17
    protected $isNew = null;
18
19
    protected $vendorId = null;
20
21
    protected $gradesCount = null;
22
23
    protected $categoryId = null;
24
25
    protected $id = null;
26
27
    protected $photos = null;
28
29
    protected $link = null;
30
31
    protected $isGroup = null;
32
33
    protected $vendorName = null;
34
35
    protected $name = null;
36
37
    protected $prices = null;
38
39
    protected $description = null;
40
41
    protected $facts = null;
42
43
    protected $mainPhoto = null;
44
45
    /**
46
     * Additional properties available during listed requests.
47
     */
48
    protected $childrenCount = null;
49
50
    protected $bigPhoto = null;
51
52
    protected $previewPhoto = null;
53
54
    protected $mappingClasses = [
55
        'photos' => 'Yandex\Market\Content\Models\Photos',
56
        'prices' => 'Yandex\Market\Content\Models\Prices',
57
        'facts' => 'Yandex\Market\Content\Models\Facts',
58
        'mainPhoto' => 'Yandex\Market\Content\Models\Base\Photo',
59
        'bigPhoto' => 'Yandex\Market\Content\Models\Base\Photo',
60
        'previewPhoto' => 'Yandex\Market\Content\Models\Base\Photo'
61
    ];
62
63
    protected $propNameMap = [
64
        'vendor' => 'vendorName',
65
        'modificationsCount' => 'childrenCount',
66
        'gradeCount' => 'gradesCount'
67
    ];
68
69
    /**
70
     * Constructor
71
     *
72
     * @param array $data
73
     */
74 3
    public function __construct($data = array())
75
    {
76
        // fix photo inheritance
77
        // @todo: Check whether only one child can be inherit in "photos" property.
78 3
        if (isset($data['photos']) && count($data['photos']) == 1 && isset($data['photos']['photo'])
79 3
        ) {
80 1
            $data['photos'] = $data['photos']['photo'];
81 1
        }
82 3
        parent::__construct($data);
83 3
    }
84
85
    /**
86
     * Retrieve the offersCount property
87
     *
88
     * @return int|null
89
     */
90 3
    public function getOffersCount()
91
    {
92 3
        return $this->offersCount;
93
    }
94
95
    /**
96
     * Retrieve the rating property
97
     *
98
     * @return float|null
99
     */
100 3
    public function getRating()
101
    {
102 3
        return $this->rating;
103
    }
104
105
    /**
106
     * Retrieve the reviewsCount property
107
     *
108
     * @return int|null
109
     */
110 3
    public function getReviewsCount()
111
    {
112 3
        return $this->reviewsCount;
113
    }
114
115
    /**
116
     * Retrieve the articlesCount property
117
     *
118
     * @return int|null
119
     */
120 2
    public function getArticlesCount()
121
    {
122 2
        return $this->articlesCount;
123
    }
124
125
    /**
126
     * Retrieve the isNew property
127
     *
128
     * @return bool|null
129
     */
130 2
    public function getIsNew()
131
    {
132 2
        if ($this->isNew === null) {
133
            return null;
134
        }
135
136 2
        if ($this->isNew == 1) {
137
            return true;
138
        }
139
140 2
        return false;
141
    }
142
143
    /**
144
     * Retrieve the vendorId property
145
     *
146
     * @return int|null
147
     */
148 3
    public function getVendorId()
149
    {
150 3
        return $this->vendorId;
151
    }
152
153
    /**
154
     * Retrieve the gradesCount property
155
     *
156
     * @return int|null
157
     */
158 2
    public function getGradesCount()
159
    {
160 2
        return $this->gradesCount;
161
    }
162
163
    /**
164
     * Retrieve the categoryId property
165
     *
166
     * @return int|null
167
     */
168 3
    public function getCategoryId()
169
    {
170 3
        return $this->categoryId;
171
    }
172
173
    /**
174
     * Retrieve the id property
175
     *
176
     * @return int|null
177
     */
178 3
    public function getId()
179
    {
180 3
        return $this->id;
181
    }
182
183
    /**
184
     * Retrieve the id property
185
     *
186
     * @return Photos|null
187
     */
188 1
    public function getPhotos()
189
    {
190 1
        return $this->photos;
191
    }
192
193
    /**
194
     * Retrieve the link property
195
     *
196
     * @return string|null
197
     */
198 3
    public function getLink()
199
    {
200 3
        return $this->link;
201
    }
202
203
    /**
204
     * Retrieve the isGroup property
205
     *
206
     * @return bool|null
207
     */
208 2
    public function getIsGroup()
209
    {
210 2
        return $this->isGroup;
211
    }
212
213
    /**
214
     * Retrieve the vendorName property
215
     * @return string|null
216
     */
217 2
    public function getVendorName()
218
    {
219 2
        return $this->vendorName;
220
    }
221
222
    /**
223
     * Retrieve the name property
224
     * @return string|null
225
     */
226 3
    public function getName()
227
    {
228 3
        return $this->name;
229
    }
230
231
    /**
232
     * Retrieve the prices property
233
     *
234
     * @return Prices|null
235
     */
236 3
    public function getPrices()
237
    {
238 3
        return $this->prices;
239
    }
240
241
    /**
242
     * Retrieve the description property
243
     * @return string|null
244
     */
245 3
    public function getDescription()
246
    {
247 3
        return $this->description;
248
    }
249
250
    /**
251
     * Retrieve the facts property
252
     *
253
     * @return Facts|null
254
     */
255
    public function getFacts()
256
    {
257
        return $this->facts;
258
    }
259
260
    /**
261
     * Retrieve the mainPhoto property
262
     *
263
     * @return Photo|null
264
     */
265 3
    public function getMainPhoto()
266
    {
267 3
        return $this->mainPhoto;
268
    }
269
270
    /**
271
     * Retrieve the childrenCount property
272
     *
273
     * @note Property available during /category/{category_id}/models request.
274
     *
275
     * @return int|null
276
     */
277
    public function getChildrenCount()
278
    {
279
        return $this->childrenCount;
280
    }
281
282
    /**
283
     * Retrieve the bigPhoto property
284
     *
285
     * @note Property available during /search request.
286
     *
287
     * @return int|null
288
     */
289
    public function getBigPhoto()
290
    {
291
        return $this->bigPhoto;
292
    }
293
294
    /**
295
     * Retrieve the previewPhoto property
296
     *
297
     * @note Property available during /search request.
298
     *
299
     * @return int|null
300
     */
301 1
    public function getPreviewPhoto()
302
    {
303 1
        return $this->previewPhoto;
304
    }
305
}
306