Passed
Push — feature/switch-to-configuratio... ( 74ae66 )
by Tomas Norre
07:20
created

Queue::fromArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 11
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 14
ccs 0
cts 12
cp 0
crap 2
rs 9.9
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AOE\Crawler\Domain\Model;
6
7
/***************************************************************
8
 *  Copyright notice
9
 *
10
 *  (c) 2020 AOE GmbH <[email protected]>
11
 *
12
 *  All rights reserved
13
 *
14
 *  This script is part of the TYPO3 project. The TYPO3 project is
15
 *  free software; you can redistribute it and/or modify
16
 *  it under the terms of the GNU General Public License as published by
17
 *  the Free Software Foundation; either version 3 of the License, or
18
 *  (at your option) any later version.
19
 *
20
 *  The GNU General Public License can be found at
21
 *  http://www.gnu.org/copyleft/gpl.html.
22
 *
23
 *  This script is distributed in the hope that it will be useful,
24
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
25
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
 *  GNU General Public License for more details.
27
 *
28
 *  This copyright notice MUST APPEAR in all copies of the script!
29
 ***************************************************************/
30
31
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
32
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
33
34
/**
35
 * Class Queue
36
 */
37
class Queue extends AbstractEntity
38
{
39
    /**
40
     * @var int
41
     */
42
    protected $qid = 0;
43
44
    /**
45
     * @var int
46
     */
47
    protected $pageId = 0;
48
49
    /**
50
     * @var string
51
     */
52
    protected $parameters = '';
53
54
    /**
55
     * @var string
56
     */
57
    protected $parametersHash = '';
58
59
    /**
60
     * @var string
61
     */
62
    protected $configurationHash = '';
63
64
    /**
65
     * @var bool
66
     */
67
    protected $scheduled = false;
68
69
    /**
70
     * @var int
71
     */
72
    protected $execTime = 0;
73
74
    /**
75
     * @var int
76
     */
77
    protected $setId = 0;
78
79
    /**
80
     * @var string
81
     */
82
    protected $resultData = '';
83
84
    /**
85
     * @var bool
86
     */
87
    protected $processScheduled = false;
88
89
    /**
90
     * @var string
91
     */
92
    protected $processId = '';
93
94
    /**
95
     * @var string
96
     */
97
    protected $processIdCompleted = '';
98
99
    /**
100
     * @var ObjectStorage<Configuration>
101
     */
102
    protected $configuration;
103
104
    public static function fromArray(array $array): self
105
    {
106
        $queue = new self();
107
        $queue->setPageId($array['page_id']);
108
        $queue->setParameters($array['parameters']);
109
        $queue->setParametersHash($array['parameters']);
110
        $queue->setConfiguration($array['configuration']);
111
        $queue->setConfigurationHash($array['configuration_hash']);
112
        $queue->setScheduled($array['scheduled']);
113
        $queue->setExecTime($array['exec_time']);
114
        $queue->setSetId($array['set_id']);
115
        $queue->setResultData($array['result_data']);
116
117
        return $queue;
118
    }
119
120
    /**
121
     * @return int
122
     */
123 1
    public function getQid()
124
    {
125 1
        return $this->qid;
126
    }
127
128
    /**
129
     * @param int $qid
130
     */
131 1
    public function setQid($qid): void
132
    {
133 1
        $this->qid = $qid;
134 1
    }
135
136
    /**
137
     * @return int
138
     */
139 1
    public function getPageId()
140
    {
141 1
        return $this->pageId;
142
    }
143
144
    /**
145
     * @param int $pageId
146
     */
147 1
    public function setPageId($pageId): void
148
    {
149 1
        $this->pageId = $pageId;
150 1
    }
151
152
    /**
153
     * @return string
154
     */
155 1
    public function getParameters()
156
    {
157 1
        return $this->parameters;
158
    }
159
160
    /**
161
     * @param string $parameters
162
     */
163 1
    public function setParameters($parameters): void
164
    {
165 1
        $this->parameters = $parameters;
166 1
    }
167
168
    /**
169
     * @return string
170
     */
171 1
    public function getParametersHash()
172
    {
173 1
        return $this->parametersHash;
174
    }
175
176
    /**
177
     * @param string $parametersHash
178
     */
179 1
    public function setParametersHash($parametersHash): void
180
    {
181 1
        $this->parametersHash = $parametersHash;
182 1
    }
183
184
    /**
185
     * @return string
186
     */
187 1
    public function getConfigurationHash()
188
    {
189 1
        return $this->configurationHash;
190
    }
191
192
    /**
193
     * @param string $configurationHash
194
     */
195 1
    public function setConfigurationHash($configurationHash): void
196
    {
197 1
        $this->configurationHash = $configurationHash;
198 1
    }
199
200
    /**
201
     * @return bool
202
     */
203 1
    public function isScheduled()
204
    {
205 1
        return $this->scheduled;
206
    }
207
208
    /**
209
     * @param bool $scheduled
210
     */
211 1
    public function setScheduled($scheduled): void
212
    {
213 1
        $this->scheduled = $scheduled;
214 1
    }
215
216
    /**
217
     * @return int
218
     */
219 1
    public function getExecTime()
220
    {
221 1
        return $this->execTime;
222
    }
223
224
    /**
225
     * @param int $execTime
226
     */
227 1
    public function setExecTime($execTime): void
228
    {
229 1
        $this->execTime = $execTime;
230 1
    }
231
232
    /**
233
     * @return int
234
     */
235 1
    public function getSetId()
236
    {
237 1
        return $this->setId;
238
    }
239
240
    /**
241
     * @param int $setId
242
     */
243 1
    public function setSetId($setId): void
244
    {
245 1
        $this->setId = $setId;
246 1
    }
247
248
    /**
249
     * @return string
250
     */
251 1
    public function getResultData()
252
    {
253 1
        return $this->resultData;
254
    }
255
256
    /**
257
     * @param string $resultData
258
     */
259 1
    public function setResultData($resultData): void
260
    {
261 1
        $this->resultData = $resultData;
262 1
    }
263
264
    /**
265
     * @return bool
266
     */
267 1
    public function isProcessScheduled()
268
    {
269 1
        return $this->processScheduled;
270
    }
271
272
    /**
273
     * @param bool $processScheduled
274
     */
275 1
    public function setProcessScheduled($processScheduled): void
276
    {
277 1
        $this->processScheduled = $processScheduled;
278 1
    }
279
280
    /**
281
     * @return string
282
     */
283 1
    public function getProcessId()
284
    {
285 1
        return $this->processId;
286
    }
287
288
    /**
289
     * @param string $processId
290
     */
291 1
    public function setProcessId($processId): void
292
    {
293 1
        $this->processId = $processId;
294 1
    }
295
296
    /**
297
     * @return string
298
     */
299 1
    public function getProcessIdCompleted()
300
    {
301 1
        return $this->processIdCompleted;
302
    }
303
304
    /**
305
     * @param string $processIdCompleted
306
     */
307 1
    public function setProcessIdCompleted($processIdCompleted): void
308
    {
309 1
        $this->processIdCompleted = $processIdCompleted;
310 1
    }
311
312
    /**
313
     * @return ObjectStorage
314
     */
315 1
    public function getConfiguration()
316
    {
317 1
        return $this->configuration;
318
    }
319
320 1
    public function setConfiguration(Configuration $configuration): void
321
    {
322 1
        $this->configuration = $configuration;
0 ignored issues
show
Documentation Bug introduced by
It seems like $configuration of type AOE\Crawler\Domain\Model\Configuration is incompatible with the declared type TYPO3\CMS\Extbase\Persistence\ObjectStorage of property $configuration.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
323 1
    }
324
}
325