HeadHunter   A
last analyzed

Complexity

Total Complexity 24

Size/Duplication

Total Lines 358
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 24
eloc 38
c 2
b 0
f 0
dl 0
loc 358
rs 10

22 Methods

Rating   Name   Duplication   Size   Complexity  
A setUrl() 0 3 1
A setPerPage() 0 3 1
A getDateToFormatted() 0 7 2
A getUrl() 0 3 1
A getDateFromFormatted() 0 7 2
A setText() 0 3 1
A setConfigurationKey() 0 3 1
A getProviderUri() 0 3 1
A setOrderBy() 0 3 1
A setArea() 0 3 1
A setDateFrom() 0 3 1
A setReceived() 0 3 1
A getDateTo() 0 3 1
A setDateTo() 0 3 1
A getId() 0 3 1
A getDateFrom() 0 3 1
A getPerPage() 0 3 1
A getText() 0 3 1
A getOrderBy() 0 3 1
A getArea() 0 3 1
A getConfigurationKey() 0 3 1
A getReceived() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the Veslo project <https://github.com/symfony-doge/veslo>.
5
 *
6
 * (C) 2019 Pavel Petrov <[email protected]>.
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @license https://opensource.org/licenses/GPL-3.0 GPL-3.0
12
 */
13
14
declare(strict_types=1);
15
16
namespace Veslo\AnthillBundle\Entity\Vacancy\Roadmap\Configuration\Parameters;
17
18
use DateTimeInterface;
19
use Doctrine\ORM\Mapping as ORM;
20
use Veslo\AnthillBundle\Vacancy\Roadmap\Configuration\ParametersInterface;
21
use Veslo\AnthillBundle\Vacancy\Roadmap\Strategy\HeadHunter\Api\Version20190213 as HeadHunterApiStrategy;
22
23
/**
24
 * Parameters for vacancy search on HeadHunter website
25
 *
26
 * @ORM\Table(name="anthill_vacancy_roadmap_headhunter")
27
 * @ORM\Entity(repositoryClass="Veslo\AnthillBundle\Entity\Repository\Vacancy\Roadmap\Configuration\Parameters\HeadHunterRepository")
28
 * @ORM\Cache(usage="READ_WRITE", region="roadmap_parameters_head_hunter")
29
 */
30
class HeadHunter implements ParametersInterface
31
{
32
    /**
33
     * DateTime format
34
     *
35
     * @const string
36
     */
37
    public const DATETIME_FORMAT = 'Y-m-d\TH:i:s';
38
39
    /**
40
     * Parameters record identifier
41
     *
42
     * @var int
43
     *
44
     * @ORM\Column(name="id", type="integer", options={"comment": "Parameters record identifier"})
45
     * @ORM\Id
46
     * @ORM\GeneratedValue(strategy="AUTO")
47
     */
48
    private $id;
49
50
    /**
51
     * Roadmap configuration key to which parameters belongs to
52
     *
53
     * @var string
54
     *
55
     * @ORM\Column(
56
     *     name="configuration_key",
57
     *     type="string",
58
     *     length=255,
59
     *     unique=true,
60
     *     options={"comment": "Roadmap configuration key to which parameters belongs to"}
61
     * )
62
     */
63
    private $configurationKey;
64
65
    /**
66
     * Vacancy website URL
67
     *
68
     * @var string
69
     *
70
     * @ORM\Column(name="url", type="string", length=255, options={"comment": "Vacancy website URL"})
71
     */
72
    private $url;
73
74
    /**
75
     * Search query text
76
     *
77
     * @var string
78
     *
79
     * @ORM\Column(name="text", type="string", length=255, options={"comment": "Search query text"})
80
     */
81
    private $text;
82
83
    /**
84
     * Vacancy area
85
     *
86
     * @var int
87
     *
88
     * @ORM\Column(name="area", type="integer", options={"unsigned": true, "comment": "Vacancy area"})
89
     */
90
    private $area;
91
92
    /**
93
     * Publication date from
94
     *
95
     * @var DateTimeInterface
96
     *
97
     * @ORM\Column(name="date_from", type="datetime", options={"comment": "Publication date from"})
98
     */
99
    private $dateFrom;
100
101
    /**
102
     * Publication date to
103
     *
104
     * @var DateTimeInterface
105
     *
106
     * @ORM\Column(name="date_to", type="datetime", options={"comment": "Publication date to"})
107
     */
108
    private $dateTo;
109
110
    /**
111
     * Order by criteria
112
     *
113
     * @var string
114
     *
115
     * @ORM\Column(name="order_by", type="string", length=255, options={"comment": "Order by criteria"})
116
     */
117
    private $orderBy;
118
119
    /**
120
     * Number of vacancies to fetch for a single page
121
     *
122
     * @var int
123
     *
124
     * @ORM\Column(
125
     *     name="per_page",
126
     *     type="integer",
127
     *     options={"unsigned": true, "comment": "Number of vacancies to fetch for a single page"}
128
     * )
129
     */
130
    private $perPage;
131
132
    /**
133
     * Vacancies received during specified publication date range
134
     * This value cannot be used in any real statistics because it can be changed by algorithms
135
     *
136
     * @var int
137
     *
138
     * @ORM\Column(
139
     *     name="received",
140
     *     type="integer",
141
     *     options={"unsigned": true, "comment": "Vacancies received during specified publication date range"}
142
     * )
143
     *
144
     * @see HeadHunterApiStrategy::determinePage()
145
     */
146
    private $received;
147
148
    /**
149
     * Returns parameters record identifier
150
     *
151
     * @return int
152
     */
153
    public function getId(): int
154
    {
155
        return $this->id;
156
    }
157
158
    /**
159
     * {@inheritdoc}
160
     */
161
    public function getConfigurationKey(): string
162
    {
163
        return $this->configurationKey;
164
    }
165
166
    /**
167
     * Sets configuration key to which parameters belongs to
168
     *
169
     * @param string $configurationKey Configuration key to which parameters belongs to
170
     *
171
     * @return void
172
     */
173
    public function setConfigurationKey(string $configurationKey): void
174
    {
175
        $this->configurationKey = $configurationKey;
176
    }
177
178
    /**
179
     * {@inheritdoc}
180
     */
181
    public function getProviderUri(): string
182
    {
183
        return $this->getUrl();
184
    }
185
186
    /**
187
     * Returns vacancy website URL
188
     *
189
     * @return string
190
     */
191
    public function getUrl(): string
192
    {
193
        return $this->url;
194
    }
195
196
    /**
197
     * Sets vacancy website URL
198
     *
199
     * @param string $url Website URL
200
     *
201
     * @return void
202
     */
203
    public function setUrl(string $url): void
204
    {
205
        $this->url = $url;
206
    }
207
208
    /**
209
     * Returns search query text
210
     *
211
     * @return string
212
     */
213
    public function getText(): string
214
    {
215
        return $this->text;
216
    }
217
218
    /**
219
     * Sets search query text
220
     *
221
     * @param string $text Search query text
222
     *
223
     * @return void
224
     */
225
    public function setText(string $text): void
226
    {
227
        $this->text = $text;
228
    }
229
230
    /**
231
     * Returns vacancy area
232
     *
233
     * @return int
234
     */
235
    public function getArea(): int
236
    {
237
        return $this->area;
238
    }
239
240
    /**
241
     * Sets vacancy area
242
     *
243
     * @param int $area Vacancy area
244
     *
245
     * @return void
246
     */
247
    public function setArea(int $area): void
248
    {
249
        $this->area = $area;
250
    }
251
252
    /**
253
     * Returns publication date "from" part for searching vacancies within range
254
     *
255
     * @return DateTimeInterface
256
     */
257
    public function getDateFrom(): DateTimeInterface
258
    {
259
        return $this->dateFrom;
260
    }
261
262
    /**
263
     * Returns publication date "from" formatted for query argument
264
     *
265
     * @return string
266
     */
267
    public function getDateFromFormatted(): string
268
    {
269
        if (!$this->dateFrom instanceof DateTimeInterface) {
0 ignored issues
show
introduced by
$this->dateFrom is always a sub-type of DateTimeInterface.
Loading history...
270
            return '';
271
        }
272
273
        return $this->dateFrom->format(self::DATETIME_FORMAT);
274
    }
275
276
    /**
277
     * Sets publication date from
278
     *
279
     * @param DateTimeInterface $dateFrom Publication date "from" part for searching vacancies within range
280
     *
281
     * @return void
282
     */
283
    public function setDateFrom(DateTimeInterface $dateFrom): void
284
    {
285
        $this->dateFrom = $dateFrom;
286
    }
287
288
    /**
289
     * Returns publication date "to" part for searching vacancies within range
290
     *
291
     * @return DateTimeInterface
292
     */
293
    public function getDateTo(): DateTimeInterface
294
    {
295
        return $this->dateTo;
296
    }
297
298
    /**
299
     * Returns publication date "to" formatted for query argument
300
     *
301
     * @return string
302
     */
303
    public function getDateToFormatted(): string
304
    {
305
        if (!$this->dateTo instanceof DateTimeInterface) {
0 ignored issues
show
introduced by
$this->dateTo is always a sub-type of DateTimeInterface.
Loading history...
306
            return '';
307
        }
308
309
        return $this->dateTo->format(self::DATETIME_FORMAT);
310
    }
311
312
    /**
313
     * Sets publication date to
314
     *
315
     * @param DateTimeInterface $dateTo Publication date "to" part for searching vacancies within range
316
     *
317
     * @return void
318
     */
319
    public function setDateTo(DateTimeInterface $dateTo): void
320
    {
321
        $this->dateTo = $dateTo;
322
    }
323
324
    /**
325
     * Returns order by criteria
326
     *
327
     * @return string
328
     */
329
    public function getOrderBy(): string
330
    {
331
        return $this->orderBy;
332
    }
333
334
    /**
335
     * Sets order by criteria
336
     *
337
     * @param string $orderBy Order by criteria
338
     *
339
     * @return void
340
     */
341
    public function setOrderBy(string $orderBy): void
342
    {
343
        $this->orderBy = $orderBy;
344
    }
345
346
    /**
347
     * Returns number of vacancies to fetch for a single page
348
     *
349
     * @return int
350
     */
351
    public function getPerPage(): int
352
    {
353
        return $this->perPage;
354
    }
355
356
    /**
357
     * Sets number of vacancies to fetch for a single page
358
     *
359
     * @param int $perPage Number of vacancies to fetch for a single page
360
     *
361
     * @return void
362
     */
363
    public function setPerPage(int $perPage): void
364
    {
365
        $this->perPage = $perPage;
366
    }
367
368
    /**
369
     * Returns received vacancies count during specified publication date range
370
     *
371
     * @return int
372
     */
373
    public function getReceived(): int
374
    {
375
        return $this->received;
376
    }
377
378
    /**
379
     * Sets vacancies received count
380
     *
381
     * @param int $received Received vacancies count during specified publication date range
382
     *
383
     * @return void
384
     */
385
    public function setReceived(int $received): void
386
    {
387
        $this->received = $received;
388
    }
389
}
390