Test Failed
Push — main ( c76fcf...a2096a )
by Bingo
14:02
created

HistoricExternalTaskLogQueryImpl   A

Complexity

Total Complexity 37

Size/Duplication

Total Lines 271
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 37
eloc 115
c 1
b 0
f 1
dl 0
loc 271
rs 9.44

37 Methods

Rating   Name   Duplication   Size   Complexity  
A orderByProcessDefinitionKey() 0 4 1
A withoutTenantId() 0 5 1
A orderByTimestamp() 0 4 1
A setState() 0 3 1
A executeCount() 0 6 1
A activityInstanceIdIn() 0 8 1
A priorityLowerThanOrEquals() 0 4 1
A executeList() 0 6 1
A errorMessage() 0 5 1
A creationLog() 0 4 1
A orderByExecutionId() 0 4 1
A processDefinitionKey() 0 5 1
A executionIdIn() 0 8 1
A orderByActivityInstanceId() 0 4 1
A orderByProcessInstanceId() 0 4 1
A orderByTopicName() 0 4 1
A __construct() 0 3 1
A topicName() 0 5 1
A processDefinitionId() 0 5 1
A workerId() 0 5 1
A orderByRetries() 0 4 1
A orderByProcessDefinitionId() 0 4 1
A orderByActivityId() 0 4 1
A orderByTenantId() 0 4 1
A orderByExternalTaskId() 0 4 1
A priorityHigherThanOrEquals() 0 4 1
A orderByWorkerId() 0 4 1
A processInstanceId() 0 5 1
A deletionLog() 0 4 1
A successLog() 0 4 1
A orderByPriority() 0 4 1
A logId() 0 5 1
A failureLog() 0 4 1
A activityIdIn() 0 8 1
A isTenantIdSet() 0 3 1
A externalTaskId() 0 5 1
A tenantIdIn() 0 6 1
1
<?php
2
3
namespace Jabe\Engine\Impl;
4
5
use Jabe\Engine\Exception\NotValidException;
6
use Jabe\Engine\History\{
7
    ExternalTaskStateImpl,
8
    ExternalTaskStateInterface,
9
    HistoricExternalTaskLogQueryInterface
10
};
11
use Jabe\Engine\Impl\Interceptor\{
12
    CommandContext,
13
    CommandExecutorInterface
14
};
15
use Jabe\Engine\Impl\Util\{
16
    CollectionUtil,
17
    EnsureUtil
0 ignored issues
show
Bug introduced by
The type Jabe\Engine\Impl\Util\EnsureUtil was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
};
19
20
class HistoricExternalTaskLogQueryImpl extends AbstractQuery implements HistoricExternalTaskLogQueryInterface
21
{
22
    protected $id;
23
    protected $externalTaskId;
24
    protected $topicName;
25
    protected $workerId;
26
    protected $errorMessage;
27
    protected $activityIds = [];
28
    protected $activityInstanceIds = [];
29
    protected $executionIds = [];
30
    protected $processInstanceId;
31
    protected $processDefinitionId;
32
    protected $processDefinitionKey;
33
    protected $priorityHigherThanOrEqual;
34
    protected $priorityLowerThanOrEqual;
35
    protected $tenantIds = [];
36
    protected $isTenantIdSet;
37
    protected $state;
38
39
    public function __construct(CommandExecutorInterface $commandExecutor = null)
40
    {
41
        parent::__construct($commandExecutor);
42
    }
43
44
    // query parameter ////////////////////////////////////////////
45
46
    public function logId(string $historicExternalTaskLogId): HistoricExternalTaskLogQueryInterface
47
    {
48
        EnsureUtil::ensureNotNull(NotValidException::class, "historicExternalTaskLogId", $historicExternalTaskLogId);
49
        $this->id = $historicExternalTaskLogId;
50
        return $this;
51
    }
52
53
    public function externalTaskId(string $externalTaskId): HistoricExternalTaskLogQueryInterface
54
    {
55
        EnsureUtil::ensureNotNull(NotValidException::class, "externalTaskId", $externalTaskId);
56
        $this->externalTaskId = $externalTaskId;
57
        return $this;
58
    }
59
60
    public function topicName(string $topicName): HistoricExternalTaskLogQueryInterface
61
    {
62
        EnsureUtil::ensureNotNull(NotValidException::class, "topicName", $topicName);
63
        $this->topicName = $topicName;
64
        return $this;
65
    }
66
67
    public function workerId(string $workerId): HistoricExternalTaskLogQueryInterface
68
    {
69
        EnsureUtil::ensureNotNull(NotValidException::class, "workerId", $workerId);
70
        $this->workerId = $workerId;
71
        return $this;
72
    }
73
74
    public function errorMessage(string $errorMessage): HistoricExternalTaskLogQueryInterface
75
    {
76
        EnsureUtil::ensureNotNull(NotValidException::class, "errorMessage", $errorMessage);
77
        $this->errorMessage = $errorMessage;
78
        return $this;
79
    }
80
81
    public function activityIdIn(array $activityIds): HistoricExternalTaskLogQueryInterface
82
    {
83
        EnsureUtil::ensureNotNull(NotValidException::class, "activityIds", $activityIds);
84
        $activityIdList = CollectionUtil::asArrayList($activityIds);
85
        EnsureUtil::ensureNotContainsNull("activityIds", "activityIds", $activityIdList);
86
        EnsureUtil::ensureNotContainsEmptyString("activityIds", "activityIds", $activityIdList);
87
        $this->activityIds = $activityIds;
88
        return $this;
89
    }
90
91
    public function activityInstanceIdIn(array $activityInstanceIds): HistoricExternalTaskLogQueryInterface
92
    {
93
        EnsureUtil::ensureNotNull(NotValidException::class, "activityIds", $activityInstanceIds);
94
        $activityInstanceIdList = CollectionUtil::asArrayList($activityInstanceIds);
95
        EnsureUtil::ensureNotContainsNull("activityInstanceIds", $activityInstanceIdList);
96
        EnsureUtil::ensureNotContainsEmptyString("activityInstanceIds", $activityInstanceIdList);
97
        $this->activityInstanceIds = $activityInstanceIds;
98
        return $this;
99
    }
100
101
    public function executionIdIn(array $executionIds): HistoricExternalTaskLogQueryInterface
102
    {
103
        EnsureUtil::ensureNotNull(NotValidException::class, "activityIds", $executionIds);
104
        $executionIdList = CollectionUtil::asArrayList($executionIds);
105
        EnsureUtil::ensureNotContainsNull("executionIds", "executionIds", $executionIdList);
106
        EnsureUtil::ensureNotContainsEmptyString("executionIds", "executionIds", $executionIdList);
107
        $this->executionIds = $executionIds;
108
        return $this;
109
    }
110
111
    public function processInstanceId(string $processInstanceId): HistoricExternalTaskLogQueryInterface
112
    {
113
        EnsureUtil::ensureNotNull(NotValidException::class, "processInstanceId", $processInstanceId);
114
        $this->processInstanceId = $processInstanceId;
115
        return $this;
116
    }
117
118
    public function processDefinitionId(string $processDefinitionId): HistoricExternalTaskLogQueryInterface
119
    {
120
        EnsureUtil::ensureNotNull(NotValidException::class, "processDefinitionId", $processDefinitionId);
121
        $this->processDefinitionId = $processDefinitionId;
122
        return $this;
123
    }
124
125
    public function processDefinitionKey(string $processDefinitionKey): HistoricExternalTaskLogQueryInterface
126
    {
127
        EnsureUtil::ensureNotNull(NotValidException::class, "processDefinitionKey", $processDefinitionKey);
128
        $this->processDefinitionKey = $processDefinitionKey;
129
        return $this;
130
    }
131
132
    public function tenantIdIn(array $tenantIds): HistoricExternalTaskLogQueryInterface
133
    {
134
        EnsureUtil::ensureNotNull("tenantIds", "tenantIds", $tenantIds);
135
        $this->tenantIds = $tenantIds;
136
        $this->isTenantIdSet = true;
137
        return $this;
138
    }
139
140
    public function withoutTenantId(): HistoricExternalTaskLogQueryInterface
141
    {
142
        $this->tenantIds = null;
143
        $this->isTenantIdSet = true;
144
        return $this;
145
    }
146
147
    public function priorityHigherThanOrEquals(int $priority): HistoricExternalTaskLogQueryInterface
148
    {
149
        $this->priorityHigherThanOrEqual = $priority;
150
        return $this;
151
    }
152
153
    public function priorityLowerThanOrEquals(int $priority): HistoricExternalTaskLogQueryInterface
154
    {
155
        $this->priorityLowerThanOrEqual = $priority;
156
        return $this;
157
    }
158
159
    public function creationLog(): HistoricExternalTaskLogQueryInterface
160
    {
161
        $this->setState(ExternalTaskStateImpl::created());
162
        return $this;
163
    }
164
165
    public function failureLog(): HistoricExternalTaskLogQueryInterface
166
    {
167
        $this->setState(ExternalTaskState::failed());
0 ignored issues
show
Bug introduced by
The type Jabe\Engine\Impl\ExternalTaskState was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
168
        return $this;
169
    }
170
171
    public function successLog(): HistoricExternalTaskLogQueryInterface
172
    {
173
        $this->setState(ExternalTaskState::successful());
174
        return $this;
175
    }
176
177
    public function deletionLog(): HistoricExternalTaskLogQueryInterface
178
    {
179
        $this->setState(ExternalTaskState::deleted());
180
        return $this;
181
    }
182
183
    // order by //////////////////////////////////////////////
184
185
    public function orderByTimestamp(): HistoricExternalTaskLogQueryInterface
186
    {
187
        $this->orderBy(HistoricExternalTaskLogQueryProperty::timestamp());
188
        return $this;
189
    }
190
191
    public function orderByExternalTaskId(): HistoricExternalTaskLogQueryInterface
192
    {
193
        $this->orderBy(HistoricExternalTaskLogQueryProperty::externalTaskId());
194
        return $this;
195
    }
196
197
    public function orderByRetries(): HistoricExternalTaskLogQueryInterface
198
    {
199
        $this->orderBy(HistoricExternalTaskLogQueryProperty::retries());
200
        return $this;
201
    }
202
203
    public function orderByPriority(): HistoricExternalTaskLogQueryInterface
204
    {
205
        $this->orderBy(HistoricExternalTaskLogQueryProperty::priority());
206
        return $this;
207
    }
208
209
    public function orderByTopicName(): HistoricExternalTaskLogQueryInterface
210
    {
211
        $this->orderBy(HistoricExternalTaskLogQueryProperty::topicName());
212
        return $this;
213
    }
214
215
    public function orderByWorkerId(): HistoricExternalTaskLogQueryInterface
216
    {
217
        $this->orderBy(HistoricExternalTaskLogQueryProperty::workerId());
218
        return $this;
219
    }
220
221
    public function orderByActivityId(): HistoricExternalTaskLogQueryInterface
222
    {
223
        $this->orderBy(HistoricExternalTaskLogQueryProperty::activityId());
224
        return $this;
225
    }
226
227
    public function orderByActivityInstanceId(): HistoricExternalTaskLogQueryInterface
228
    {
229
        $this->orderBy(HistoricExternalTaskLogQueryProperty::activityInstanceId());
230
        return $this;
231
    }
232
233
    public function orderByExecutionId(): HistoricExternalTaskLogQueryInterface
234
    {
235
        $this->orderBy(HistoricExternalTaskLogQueryProperty::executionId());
236
        return $this;
237
    }
238
239
    public function orderByProcessInstanceId(): HistoricExternalTaskLogQueryInterface
240
    {
241
        $this->orderBy(HistoricExternalTaskLogQueryProperty::processInstanceId());
242
        return $this;
243
    }
244
245
    public function orderByProcessDefinitionId(): HistoricExternalTaskLogQueryInterface
246
    {
247
        $this->orderBy(HistoricExternalTaskLogQueryProperty::processDefinitionId());
248
        return $this;
249
    }
250
251
    public function orderByProcessDefinitionKey(): HistoricExternalTaskLogQueryInterface
252
    {
253
        $this->orderBy(HistoricExternalTaskLogQueryProperty::processDefinitionKey());
254
        return $this;
255
    }
256
257
    public function orderByTenantId(): HistoricExternalTaskLogQueryInterface
258
    {
259
        $this->orderBy(HistoricExternalTaskLogQueryProperty::tenantId());
260
        return $this;
261
    }
262
263
    // results //////////////////////////////////////////////////////////////
264
265
    public function executeCount(CommandContext $commandContext): int
266
    {
267
        $this->checkQueryOk();
268
        return $commandContext
269
            ->getHistoricExternalTaskLogManager()
270
            ->findHistoricExternalTaskLogsCountByQueryCriteria($this);
271
    }
272
273
    public function executeList(CommandContext $commandContext, Page $page): array
0 ignored issues
show
Bug introduced by
The type Jabe\Engine\Impl\Page was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
274
    {
275
        $this->checkQueryOk();
276
        return $commandContext
277
            ->getHistoricExternalTaskLogManager()
278
            ->findHistoricExternalTaskLogsByQueryCriteria($this, $page);
279
    }
280
281
    // getters & setters ////////////////////////////////////////////////////////////
282
283
    protected function setState(ExternalTaskStateInterface $state): void
284
    {
285
        $this->state = $state;
286
    }
287
288
    public function isTenantIdSet(): bool
289
    {
290
        return $this->isTenantIdSet;
291
    }
292
}
293