HistoricTaskInstanceQueryImpl   F
last analyzed

Complexity

Total Complexity 204

Size/Duplication

Total Lines 1121
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 204
eloc 398
dl 0
loc 1121
rs 2
c 0
b 0
f 0

142 Methods

Rating   Name   Duplication   Size   Complexity  
A getTaskDefinitionKeys() 0 3 1
A taskOwnerLike() 0 4 1
A processVariableValueEquals() 0 4 1
A taskAssignee() 0 4 1
A getProcessInstanceId() 0 3 1
A orderByHistoricActivityInstanceId() 0 8 2
A getProcessDefinitionId() 0 3 1
A taskDescription() 0 4 1
B hasExcludingConditions() 0 10 10
A orderByExecutionId() 0 8 2
A activityInstanceIdIn() 0 5 1
A getTaskAssigneeLike() 0 3 1
A getStartedAfter() 0 3 1
A getFinishedAfter() 0 3 1
A orderByTaskAssignee() 0 8 2
A isOrQueryActive() 0 3 1
A orderByProcessInstanceId() 0 8 2
A taskAssigned() 0 4 1
A orderByTenantId() 0 6 2
A executionId() 0 4 1
A getDueAfter() 0 3 1
A getFollowUpBefore() 0 3 1
A taskFollowUpAfter() 0 4 1
A getProcessDefinitionKey() 0 3 1
A taskDeleteReasonLike() 0 4 1
A getTaskDeleteReasonLike() 0 3 1
A getTaskHadCandidateUser() 0 3 1
A isBoolean() 0 6 4
A getExecutionId() 0 3 1
A getTaskOwner() 0 3 1
A taskUnassigned() 0 4 1
A processVariableValueGreaterThan() 0 4 1
A withoutCandidateGroups() 0 8 2
A taskAssigneeLike() 0 4 1
A processDefinitionName() 0 4 1
A taskName() 0 4 1
A processDefinitionId() 0 4 1
A isWithoutCandidateGroups() 0 3 1
A getFollowUpDate() 0 3 1
A finishedAfter() 0 4 1
A startedAfter() 0 4 1
A getTaskOwnerLike() 0 3 1
A startedBefore() 0 4 1
A taskDefinitionKey() 0 3 1
C addVariable() 0 29 12
A __construct() 0 4 1
A getProcessInstanceBusinessKey() 0 3 1
A isUnfinished() 0 3 1
A getDueBefore() 0 3 1
A orderByHistoricTaskInstanceDuration() 0 8 2
A setOrQueryActive() 0 3 1
A getProcessDefinitionName() 0 3 1
A taskNameLike() 0 4 1
A getTaskDescriptionLike() 0 3 1
A orderByHistoricActivityInstanceStartTime() 0 8 2
A getTaskNameLike() 0 3 1
A executeCount() 0 7 1
A getTaskParentTaskId() 0 3 1
A getQueries() 0 3 1
A isProcessUnfinished() 0 3 1
A taskHadCandidateGroup() 0 4 1
A getStartedBefore() 0 3 1
A taskFollowUpBefore() 0 4 1
A getTaskName() 0 3 1
A getFollowUpAfter() 0 3 1
A getTaskPriority() 0 3 1
A taskInvolvedUser() 0 4 1
A processDefinitionKey() 0 4 1
A orderByTaskName() 0 8 2
A finished() 0 4 1
A isUnassigned() 0 3 1
A orderByTaskDescription() 0 8 2
A isTenantIdSet() 0 3 1
A processInstanceBusinessKeyIn() 0 5 1
A getTaskHadCandidateGroup() 0 3 1
A getTaskDescription() 0 3 1
A orderByTaskPriority() 0 8 2
A addOrQuery() 0 4 1
A taskParentTaskId() 0 4 1
A taskId() 0 4 1
A getActivityInstanceIds() 0 3 1
A processVariableValueGreaterThanOrEquals() 0 4 1
A processVariableValueNotEquals() 0 4 1
A taskHadCandidateUser() 0 4 1
A getTaskId() 0 3 1
A matchVariableValuesIgnoreCase() 0 7 2
A getTenantIds() 0 3 1
A processInstanceBusinessKey() 0 4 1
A orderByTaskId() 0 8 2
A endOr() 0 6 3
A processInstanceId() 0 4 1
A getTaskDeleteReason() 0 3 1
A getVariables() 0 3 1
A taskDueBefore() 0 12 3
A withCandidateGroups() 0 8 2
A taskDueDate() 0 12 3
A withoutTenantId() 0 5 1
A processUnfinished() 0 4 1
A getDueDate() 0 3 1
A getFinishedBefore() 0 3 1
A isAssigned() 0 3 1
A isWithCandidateGroups() 0 3 1
A or() 0 11 2
A orderByHistoricTaskInstanceEndTime() 0 8 2
A getProcessInstanceBusinessKeys() 0 3 1
A ensureVariablesInitialized() 0 13 5
A taskPriority() 0 4 1
A processVariableValueLessThan() 0 4 1
A tenantIdIn() 0 6 1
A getVariableValuesIgnoreCase() 0 3 1
A executeList() 0 7 1
A isWithoutTaskDueDate() 0 3 1
A isFinished() 0 3 1
A taskDescriptionLike() 0 4 1
A taskDefinitionKeyIn() 0 5 1
A isProcessFinished() 0 3 1
A processVariableValueLike() 0 4 1
A taskInvolvedGroup() 0 4 1
A withoutTaskDueDate() 0 12 5
A getTaskAssignee() 0 3 1
A orderByDeleteReason() 0 8 2
A getVariableNamesIgnoreCase() 0 3 1
A taskOwner() 0 4 1
A processInstanceBusinessKeyLike() 0 4 1
A matchVariableNamesIgnoreCase() 0 7 2
A finishedBefore() 0 4 1
A taskDueAfter() 0 12 3
A orderByTaskDueDate() 0 8 2
A processVariableValueNotLike() 0 4 1
A unfinished() 0 4 1
A processVariableValueLessThanOrEquals() 0 4 1
A orderByTaskDefinitionKey() 0 8 2
A orderByProcessDefinitionId() 0 8 2
A orderByTaskFollowUpDate() 0 8 2
A taskDeleteReason() 0 4 1
A getTaskInvolvedGroup() 0 3 1
A orderByTaskOwner() 0 8 2
A getTaskInvolvedUser() 0 3 1
A getProcessInstanceBusinessKeyLike() 0 3 1
A taskVariableValueEquals() 0 4 1
A taskFollowUpDate() 0 4 1
A processFinished() 0 4 1

How to fix   Complexity   

Complex Class

Complex classes like HistoricTaskInstanceQueryImpl often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use HistoricTaskInstanceQueryImpl, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
namespace Jabe\Impl;
4
5
use Jabe\ProcessEngineException;
6
use Jabe\Exception\NotValidException;
7
use Jabe\History\{
8
    HistoricTaskInstanceInterface,
9
    HistoricTaskInstanceQueryInterface
10
};
11
use Jabe\Impl\Cfg\ProcessEngineConfigurationImpl;
12
use Jabe\Impl\Context\Context;
13
use Jabe\Impl\Interceptor\{
14
    CommandContext,
15
    CommandExecutorInterface
16
};
17
use Jabe\Impl\Util\{
18
    CompareUtil,
19
    EnsureUtil
20
};
21
22
class HistoricTaskInstanceQueryImpl extends AbstractQuery implements HistoricTaskInstanceQueryInterface
23
{
24
    protected $processDefinitionId;
25
    protected $processDefinitionKey;
26
    protected $processDefinitionName;
27
    protected $processInstanceId;
28
    protected $processInstanceBusinessKey;
29
    protected $processInstanceBusinessKeys = [];
30
    protected $processInstanceBusinessKeyLike;
31
    protected $executionId;
32
    protected $activityInstanceIds = [];
33
    protected $taskId;
34
    protected $taskName;
35
    protected $taskNameLike;
36
    protected $taskParentTaskId;
37
    protected $taskDescription;
38
    protected $taskDescriptionLike;
39
    protected $taskDeleteReason;
40
    protected $taskDeleteReasonLike;
41
    protected $taskOwner;
42
    protected $taskOwnerLike;
43
    protected $assigned;
44
    protected $unassigned;
45
    protected $taskAssignee;
46
    protected $taskAssigneeLike;
47
    protected $taskDefinitionKeys = [];
48
    protected $taskInvolvedUser;
49
    protected $taskInvolvedGroup;
50
    protected $taskHadCandidateUser;
51
    protected $taskHadCandidateGroup;
52
    protected $withCandidateGroups;
53
    protected $withoutCandidateGroups;
54
    protected $taskPriority;
55
    protected $finished;
56
    protected $unfinished;
57
    protected $processFinished;
58
    protected $processUnfinished;
59
    protected $variables = [];
60
    protected $variableNamesIgnoreCase;
61
    protected $variableValuesIgnoreCase;
62
63
    protected $dueDate;
64
    protected $dueAfter;
65
    protected $dueBefore;
66
    protected $isWithoutTaskDueDate;
67
68
    protected $followUpDate;
69
    protected $followUpBefore;
70
    protected $followUpAfter;
71
72
    protected $tenantIds = [];
73
    protected $isTenantIdSet;
74
75
    protected $caseDefinitionId;
76
    protected $caseDefinitionKey;
77
    protected $caseDefinitionName;
78
    protected $caseInstanceId;
79
    protected $caseExecutionId;
80
81
    protected $finishedAfter;
82
    protected $finishedBefore;
83
    protected $startedAfter;
84
    protected $startedBefore;
85
86
    protected $queries = [];
87
    protected $isOrQueryActive = false;
88
89
    public function __construct(CommandExecutorInterface $commandExecutor)
90
    {
91
        parent::__construct($commandExecutor);
92
        $this->queries[] = $this;
93
    }
94
95
    public function executeCount(CommandContext $commandContext): int
96
    {
97
        $this->ensureVariablesInitialized();
98
        $this->checkQueryOk();
99
        return $commandContext
100
            ->getHistoricTaskInstanceManager()
101
            ->findHistoricTaskInstanceCountByQueryCriteria($this);
102
    }
103
104
    public function executeList(CommandContext $commandContext, Page $page): array
105
    {
106
        $this->ensureVariablesInitialized();
107
        $this->checkQueryOk();
108
        return $commandContext
109
            ->getHistoricTaskInstanceManager()
110
            ->findHistoricTaskInstancesByQueryCriteria($this, $page);
111
    }
112
113
    public function processInstanceId(string $processInstanceId): HistoricTaskInstanceQueryImpl
114
    {
115
        $this->processInstanceId = $processInstanceId;
116
        return $this;
117
    }
118
119
    public function processInstanceBusinessKey(string $processInstanceBusinessKey): HistoricTaskInstanceQueryInterface
120
    {
121
        $this->processInstanceBusinessKey = $processInstanceBusinessKey;
122
        return $this;
123
    }
124
125
    public function processInstanceBusinessKeyIn(array $processInstanceBusinessKeys): HistoricTaskInstanceQueryInterface
126
    {
127
        EnsureUtil::ensureNotNull("processInstanceBusinessKeys", "processInstanceBusinessKeys", $processInstanceBusinessKeys);
128
        $this->processInstanceBusinessKeys = $processInstanceBusinessKeys;
129
        return $this;
130
    }
131
132
    public function processInstanceBusinessKeyLike(string $processInstanceBusinessKey): HistoricTaskInstanceQueryInterface
133
    {
134
        $this->processInstanceBusinessKeyLike = $processInstanceBusinessKey;
135
        return $this;
136
    }
137
138
    public function executionId(string $executionId): HistoricTaskInstanceQueryImpl
139
    {
140
        $this->executionId = $executionId;
141
        return $this;
142
    }
143
144
    public function activityInstanceIdIn(array $activityInstanceIds): HistoricTaskInstanceQueryInterface
145
    {
146
        EnsureUtil::ensureNotNull("activityInstanceIds", "activityInstanceIds", $activityInstanceIds);
147
        $this->activityInstanceIds = $activityInstanceIds;
148
        return $this;
149
    }
150
151
    public function processDefinitionId(string $processDefinitionId): HistoricTaskInstanceQueryImpl
152
    {
153
        $this->processDefinitionId = $processDefinitionId;
154
        return $this;
155
    }
156
157
    public function processDefinitionKey(string $processDefinitionKey): HistoricTaskInstanceQueryInterface
158
    {
159
        $this->processDefinitionKey = $processDefinitionKey;
160
        return $this;
161
    }
162
163
    public function processDefinitionName(string $processDefinitionName): HistoricTaskInstanceQueryInterface
164
    {
165
        $this->processDefinitionName = $processDefinitionName;
166
        return $this;
167
    }
168
169
    public function taskId(string $taskId): HistoricTaskInstanceQueryInterface
170
    {
171
        $this->taskId = $taskId;
172
        return $this;
173
    }
174
175
    public function taskName(string $taskName): HistoricTaskInstanceQueryImpl
176
    {
177
        $this->taskName = $taskName;
178
        return $this;
179
    }
180
181
    public function taskNameLike(string $taskNameLike): HistoricTaskInstanceQueryImpl
182
    {
183
        $this->taskNameLike = $taskNameLike;
184
        return $this;
185
    }
186
187
    public function taskParentTaskId(string $parentTaskId): HistoricTaskInstanceQueryInterface
188
    {
189
        $this->taskParentTaskId = $parentTaskId;
190
        return $this;
191
    }
192
193
    public function taskDescription(string $taskDescription): HistoricTaskInstanceQueryImpl
194
    {
195
        $this->taskDescription = $taskDescription;
196
        return $this;
197
    }
198
199
    public function taskDescriptionLike(string $taskDescriptionLike): HistoricTaskInstanceQueryImpl
200
    {
201
        $this->taskDescriptionLike = $taskDescriptionLike;
202
        return $this;
203
    }
204
205
    public function taskDeleteReason(string $taskDeleteReason): HistoricTaskInstanceQueryImpl
206
    {
207
        $this->taskDeleteReason = $taskDeleteReason;
208
        return $this;
209
    }
210
211
    public function taskDeleteReasonLike(string $taskDeleteReasonLike): HistoricTaskInstanceQueryImpl
212
    {
213
        $this->taskDeleteReasonLike = $taskDeleteReasonLike;
214
        return $this;
215
    }
216
217
    public function taskAssigned(): HistoricTaskInstanceQueryImpl
218
    {
219
        $this->assigned = true;
220
        return $this;
221
    }
222
223
    public function taskUnassigned(): HistoricTaskInstanceQueryImpl
224
    {
225
        $this->unassigned = true;
226
        return $this;
227
    }
228
229
    public function taskAssignee(string $taskAssignee): HistoricTaskInstanceQueryImpl
230
    {
231
        $this->taskAssignee = $taskAssignee;
232
        return $this;
233
    }
234
235
    public function taskAssigneeLike(string $taskAssigneeLike): HistoricTaskInstanceQueryImpl
236
    {
237
        $this->taskAssigneeLike = $taskAssigneeLike;
238
        return $this;
239
    }
240
241
    public function taskOwner(string $taskOwner): HistoricTaskInstanceQueryImpl
242
    {
243
        $this->taskOwner = $taskOwner;
244
        return $this;
245
    }
246
247
    public function taskOwnerLike(string $taskOwnerLike): HistoricTaskInstanceQueryImpl
248
    {
249
        $this->taskOwnerLike = $taskOwnerLike;
250
        return $this;
251
    }
252
253
    /*public HistoricTaskInstanceQueryInterface caseDefinitionId(string $caseDefinitionId) {
254
        $this->caseDefinitionId = caseDefinitionId;
255
        return $this;
256
    }
257
258
    public HistoricTaskInstanceQueryInterface caseDefinitionKey(string $caseDefinitionKey) {
259
        $this->caseDefinitionKey = caseDefinitionKey;
260
        return $this;
261
    }
262
263
    public HistoricTaskInstanceQueryInterface caseDefinitionName(string $caseDefinitionName) {
264
        $this->caseDefinitionName = caseDefinitionName;
265
        return $this;
266
    }
267
268
    public HistoricTaskInstanceQueryInterface caseInstanceId(string $caseInstanceId) {
269
        $this->caseInstanceId = caseInstanceId;
270
        return $this;
271
    }
272
273
    public HistoricTaskInstanceQueryInterface caseExecutionId(string $caseExecutionId) {
274
        $this->caseExecutionId = caseExecutionId;
275
        return $this;
276
    }*/
277
278
    public function finished(): HistoricTaskInstanceQueryImpl
279
    {
280
        $this->finished = true;
281
        return $this;
282
    }
283
284
    public function unfinished(): HistoricTaskInstanceQueryImpl
285
    {
286
        $this->unfinished = true;
287
        return $this;
288
    }
289
290
    public function matchVariableNamesIgnoreCase(): HistoricTaskInstanceQueryInterface
291
    {
292
        $this->variableNamesIgnoreCase = true;
293
        foreach ($this->variables as $variable) {
294
            $variable->setVariableNameIgnoreCase(true);
295
        }
296
        return $this;
297
    }
298
299
    public function matchVariableValuesIgnoreCase(): HistoricTaskInstanceQueryInterface
300
    {
301
        $this->variableValuesIgnoreCase = true;
302
        foreach ($this->variables as $variable) {
303
            $variable->setVariableValueIgnoreCase(true);
304
        }
305
        return $this;
306
    }
307
308
    public function taskVariableValueEquals(string $variableName, $variableValue): HistoricTaskInstanceQueryImpl
309
    {
310
        $this->addVariable($variableName, $variableValue, QueryOperator::EQUALS, true, false);
311
        return $this;
312
    }
313
314
    public function processVariableValueEquals(string $variableName, $variableValue): HistoricTaskInstanceQueryInterface
315
    {
316
        $this->addVariable($variableName, $variableValue, QueryOperator::EQUALS, false, true);
317
        return $this;
318
    }
319
320
    public function processVariableValueNotEquals(string $variableName, $variableValue): HistoricTaskInstanceQueryInterface
321
    {
322
        $this->addVariable($variableName, $variableValue, QueryOperator::NOT_EQUALS, false, true);
323
        return $this;
324
    }
325
326
    public function processVariableValueLike(string $variableName, $variableValue): HistoricTaskInstanceQueryInterface
327
    {
328
        $this->addVariable($variableName, $variableValue, QueryOperator::LIKE, false, true);
329
        return $this;
330
    }
331
332
    public function processVariableValueNotLike(string $variableName, $variableValue): HistoricTaskInstanceQueryInterface
333
    {
334
        $this->addVariable($variableName, $variableValue, QueryOperator::NOT_LIKE, false, true);
335
        return $this;
336
    }
337
338
    public function processVariableValueGreaterThan(string $variableName, $variableValue): HistoricTaskInstanceQueryInterface
339
    {
340
        $this->addVariable($variableName, $variableValue, QueryOperator::GREATER_THAN, false, true);
341
        return $this;
342
    }
343
344
    public function processVariableValueGreaterThanOrEquals(string $variableName, $variableValue): HistoricTaskInstanceQueryInterface
345
    {
346
        $this->addVariable($variableName, $variableValue, QueryOperator::GREATER_THAN_OR_EQUAL, false, true);
347
        return $this;
348
    }
349
350
    public function processVariableValueLessThan(string $variableName, $variableValue): HistoricTaskInstanceQueryInterface
351
    {
352
        $this->addVariable($variableName, $variableValue, QueryOperator::LESS_THAN, false, true);
353
        return $this;
354
    }
355
356
    public function processVariableValueLessThanOrEquals(string $variableName, $variableValue): HistoricTaskInstanceQueryInterface
357
    {
358
        $this->addVariable($variableName, $variableValue, QueryOperator::LESS_THAN_OR_EQUAL, false, true);
359
        return $this;
360
    }
361
362
    public function taskDefinitionKey(string $taskDefinitionKey): HistoricTaskInstanceQueryInterface
363
    {
364
        return $this->taskDefinitionKeyIn($taskDefinitionKey);
0 ignored issues
show
Bug introduced by
$taskDefinitionKey of type string is incompatible with the type array expected by parameter $taskDefinitionKeys of Jabe\Impl\HistoricTaskIn...::taskDefinitionKeyIn(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

364
        return $this->taskDefinitionKeyIn(/** @scrutinizer ignore-type */ $taskDefinitionKey);
Loading history...
365
    }
366
367
    public function taskDefinitionKeyIn(array $taskDefinitionKeys): HistoricTaskInstanceQueryInterface
368
    {
369
        EnsureUtil::ensureNotNull(NotValidException::class, "taskDefinitionKeys", $taskDefinitionKeys);
370
        $this->taskDefinitionKeys = $taskDefinitionKeys;
371
        return $this;
372
    }
373
374
    public function taskPriority(int $taskPriority): HistoricTaskInstanceQueryInterface
375
    {
376
        $this->taskPriority = $taskPriority;
377
        return $this;
378
    }
379
380
    public function processFinished(): HistoricTaskInstanceQueryInterface
381
    {
382
        $this->processFinished = true;
383
        return $this;
384
    }
385
386
    public function taskInvolvedUser(string $userId): HistoricTaskInstanceQueryInterface
387
    {
388
        $this->taskInvolvedUser = $userId;
389
        return $this;
390
    }
391
392
    public function taskInvolvedGroup(string $groupId): HistoricTaskInstanceQueryInterface
393
    {
394
        $this->taskInvolvedGroup = $groupId;
395
        return $this;
396
    }
397
398
    public function taskHadCandidateUser(string $userId): HistoricTaskInstanceQueryInterface
399
    {
400
        $this->taskHadCandidateUser = $userId;
401
        return $this;
402
    }
403
404
    public function taskHadCandidateGroup(string $groupId): HistoricTaskInstanceQueryInterface
405
    {
406
        $this->taskHadCandidateGroup = $groupId;
407
        return $this;
408
    }
409
410
    public function withCandidateGroups(): HistoricTaskInstanceQueryInterface
411
    {
412
        if ($this->isOrQueryActive) {
413
            throw new ProcessEngineException("Invalid query usage: cannot set withCandidateGroups() within 'or' query");
414
        }
415
416
        $this->withCandidateGroups = true;
417
        return $this;
418
    }
419
420
    public function withoutCandidateGroups(): HistoricTaskInstanceQueryInterface
421
    {
422
        if ($this->isOrQueryActive) {
423
            throw new ProcessEngineException("Invalid query usage: cannot set withoutCandidateGroups() within 'or' query");
424
        }
425
426
        $this->withoutCandidateGroups = true;
427
        return $this;
428
    }
429
430
    public function processUnfinished(): HistoricTaskInstanceQueryInterface
431
    {
432
        $this->processUnfinished = true;
433
        return $this;
434
    }
435
436
    protected function ensureVariablesInitialized(): void
437
    {
438
        $processEngineConfiguration = Context::getProcessEngineConfiguration();
439
        $variableSerializers = $processEngineConfiguration->getVariableSerializers();
0 ignored issues
show
Bug introduced by
The method getVariableSerializers() does not exist on Jabe\Impl\Cfg\ProcessEngineConfigurationImpl. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

439
        /** @scrutinizer ignore-call */ 
440
        $variableSerializers = $processEngineConfiguration->getVariableSerializers();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
440
        $dbType = $processEngineConfiguration->getDatabaseType();
441
        foreach ($this->variables as $var) {
442
            $var->initialize($variableSerializers, $dbType);
443
        }
444
445
        if (!empty($this->queries)) {
446
            foreach ($this->queries as $orQuery) {
447
                foreach ($orQuery->variables as $var) {
448
                    $var->initialize($variableSerializers, $dbType);
449
                }
450
            }
451
        }
452
    }
453
454
    public function addVariable($nameOrValue, $value = null, string $operator = null, bool $isTaskVariable = null, bool $isProcessInstanceVariable = null): void
455
    {
456
        if ($nameOrValue instanceof TaskQueryVariableValue) {
457
            $this->variables[] = $nameOrValue;
458
        } else {
459
            EnsureUtil::ensureNotNull("name", "name", $nameOrValue);
460
            if ($value === null || $this->isBoolean($value)) {
461
                // Null-values and booleans can only be used in EQUALS and NOT_EQUALS
462
                switch ($operator) {
463
                    case QueryOperator::GREATER_THAN:
464
                        throw new ProcessEngineException("Booleans and null cannot be used in 'greater than' condition");
465
                    case QueryOperator::LESS_THAN:
466
                        throw new ProcessEngineException("Booleans and null cannot be used in 'less than' condition");
467
                    case QueryOperator::GREATER_THAN_OR_EQUAL:
468
                        throw new ProcessEngineException("Booleans and null cannot be used in 'greater than or equal' condition");
469
                    case QueryOperator::LESS_THAN_OR_EQUAL:
470
                        throw new ProcessEngineException("Booleans and null cannot be used in 'less than or equal' condition");
471
                    case QueryOperator::LIKE:
472
                        throw new ProcessEngineException("Booleans and null cannot be used in 'like' condition");
473
                    case QueryOperator::NOT_LIKE:
474
                        throw new ProcessEngineException("Booleans and null cannot be used in 'not like' condition");
475
                    default:
476
                        break;
477
                }
478
            }
479
            $shouldMatchVariableValuesIgnoreCase = $this->variableValuesIgnoreCase && $value !== null && is_string($value);
480
            $shouldMatchVariableNamesIgnoreCase = $this->variableNamesIgnoreCase;
481
            $this->addVariable(
482
                new TaskQueryVariableValue($name, $value, $operator, $isTaskVariable, $isProcessInstanceVariable, $shouldMatchVariableNamesIgnoreCase, $shouldMatchVariableValuesIgnoreCase)
0 ignored issues
show
Bug introduced by
It seems like $isTaskVariable can also be of type null; however, parameter $isTaskVariable of Jabe\Impl\TaskQueryVariableValue::__construct() does only seem to accept boolean, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

482
                new TaskQueryVariableValue($name, $value, $operator, /** @scrutinizer ignore-type */ $isTaskVariable, $isProcessInstanceVariable, $shouldMatchVariableNamesIgnoreCase, $shouldMatchVariableValuesIgnoreCase)
Loading history...
Bug introduced by
It seems like $operator can also be of type null; however, parameter $operator of Jabe\Impl\TaskQueryVariableValue::__construct() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

482
                new TaskQueryVariableValue($name, $value, /** @scrutinizer ignore-type */ $operator, $isTaskVariable, $isProcessInstanceVariable, $shouldMatchVariableNamesIgnoreCase, $shouldMatchVariableValuesIgnoreCase)
Loading history...
Comprehensibility Best Practice introduced by
The variable $name seems to be never defined.
Loading history...
Bug introduced by
It seems like $isProcessInstanceVariable can also be of type null; however, parameter $isProcessInstanceVariable of Jabe\Impl\TaskQueryVariableValue::__construct() does only seem to accept boolean, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

482
                new TaskQueryVariableValue($name, $value, $operator, $isTaskVariable, /** @scrutinizer ignore-type */ $isProcessInstanceVariable, $shouldMatchVariableNamesIgnoreCase, $shouldMatchVariableValuesIgnoreCase)
Loading history...
483
            );
484
        }
485
    }
486
487
    private function isBoolean($value): bool
488
    {
489
        if ($value === null) {
490
            return false;
491
        }
492
        return is_bool($value) || strtolower($value) === "true" || strtolower($value) === "false";
493
    }
494
495
    public function taskDueDate(string $dueDate): HistoricTaskInstanceQueryInterface
496
    {
497
        // The taskDueDate filter can't be used in an AND query with
498
        // the withoutTaskDueDate filter. They can be combined in an OR query
499
        if (!$this->isOrQueryActive) {
500
            if ($this->isWithoutTaskDueDate) {
501
                throw new ProcessEngineException("Invalid query usage: cannot set both taskDueDate and withoutTaskDueDate filters.");
502
            }
503
        }
504
505
        $this->dueDate = $dueDate;
506
        return $this;
507
    }
508
509
    public function taskDueAfter(string $dueAfter): HistoricTaskInstanceQueryInterface
510
    {
511
        // The taskDueAfter filter can't be used in an AND query with
512
        // the withoutTaskDueDate filter. They can be combined in an OR query
513
        if (!$this->isOrQueryActive) {
514
            if ($this->isWithoutTaskDueDate) {
515
                throw new ProcessEngineException("Invalid query usage: cannot set both taskDueAfter and withoutTaskDueDate filters.");
516
            }
517
        }
518
519
        $this->dueAfter = $dueAfter;
520
        return $this;
521
    }
522
523
    public function taskDueBefore(string $dueBefore): HistoricTaskInstanceQueryInterface
524
    {
525
        // The taskDueBefore filter can't be used in an AND query with
526
        // the withoutTaskDueDate filter. They can be combined in an OR query
527
        if (!$this->isOrQueryActive) {
528
            if ($this->isWithoutTaskDueDate) {
529
                throw new ProcessEngineException("Invalid query usage: cannot set both taskDueBefore and withoutTaskDueDate filters.");
530
            }
531
        }
532
533
        $this->dueBefore = $dueBefore;
534
        return $this;
535
    }
536
537
    public function withoutTaskDueDate(): HistoricTaskInstanceQueryInterface
538
    {
539
        // The due date filters can't be used in an AND query with
540
        // the withoutTaskDueDate filter. They can be combined in an OR query
541
        if (!$this->isOrQueryActive) {
542
            if ($this->dueAfter !== null || $this->dueBefore !== null || $this->dueDate !== null) {
543
                throw new ProcessEngineException("Invalid query usage: cannot set both task due date (equal to, before, or after) and withoutTaskDueDate filters.");
544
            }
545
        }
546
547
        $this->isWithoutTaskDueDate = true;
548
        return $this;
549
    }
550
551
    public function taskFollowUpDate(string $followUpDate): HistoricTaskInstanceQueryInterface
552
    {
553
        $this->followUpDate = $followUpDate;
554
        return $this;
555
    }
556
557
    public function taskFollowUpBefore(string $followUpBefore): HistoricTaskInstanceQueryInterface
558
    {
559
        $this->followUpBefore = $followUpBefore;
560
        return $this;
561
    }
562
563
    public function taskFollowUpAfter(string $followUpAfter): HistoricTaskInstanceQueryInterface
564
    {
565
        $this->followUpAfter = $followUpAfter;
566
        return $this;
567
    }
568
569
    public function tenantIdIn(array $tenantIds): HistoricTaskInstanceQueryInterface
570
    {
571
        EnsureUtil::ensureNotNull("tenantIds", "tenantIds", $tenantIds);
572
        $this->tenantIds = $tenantIds;
573
        $this->isTenantIdSet = true;
574
        return $this;
575
    }
576
577
    public function withoutTenantId(): HistoricTaskInstanceQueryInterface
578
    {
579
        $this->tenantIds = null;
580
        $this->isTenantIdSet = true;
581
        return $this;
582
    }
583
584
    public function finishedAfter(string $date): HistoricTaskInstanceQueryInterface
585
    {
586
        $this->finishedAfter = $date;
587
        return $this;
588
    }
589
590
    public function finishedBefore(string $date): HistoricTaskInstanceQueryInterface
591
    {
592
        $this->finishedBefore = $date;
593
        return $this;
594
    }
595
596
    public function startedAfter(string $date): HistoricTaskInstanceQueryInterface
597
    {
598
        $this->startedAfter = $date;
599
        return $this;
600
    }
601
602
    public function startedBefore(string $date): HistoricTaskInstanceQueryInterface
603
    {
604
        $this->startedBefore = $date;
605
        return $this;
606
    }
607
608
    protected function hasExcludingConditions(): bool
609
    {
610
        return parent::hasExcludingConditions()
611
            || ($this->finished && $this->unfinished)
612
            || ($this->processFinished && $this->processUnfinished)
613
            || CompareUtil::areNotInAscendingOrder($this->startedAfter, $this->startedBefore)
614
            || CompareUtil::areNotInAscendingOrder($this->finishedAfter, $this->finishedBefore)
615
            || CompareUtil::areNotInAscendingOrder($this->dueAfter, $this->dueDate, $this->dueBefore)
616
            || CompareUtil::areNotInAscendingOrder($this->followUpAfter, $this->followUpDate, $this->followUpBefore)
617
            || CompareUtil::elementIsNotContainedInArray($this->processInstanceBusinessKey, $this->processInstanceBusinessKeys);
0 ignored issues
show
Bug introduced by
$this->processInstanceBusinessKeys of type array is incompatible with the type Jabe\Impl\Util\to expected by parameter $values of Jabe\Impl\Util\CompareUt...IsNotContainedInArray(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

617
            || CompareUtil::elementIsNotContainedInArray($this->processInstanceBusinessKey, /** @scrutinizer ignore-type */ $this->processInstanceBusinessKeys);
Loading history...
618
    }
619
620
    public function orderByTaskId(): HistoricTaskInstanceQueryImpl
621
    {
622
        if ($this->isOrQueryActive) {
623
            throw new ProcessEngineException("Invalid query usage: cannot set orderByTaskId() within 'or' query");
624
        }
625
626
        $this->orderBy(HistoricTaskInstanceQueryProperty::historicTaskInstanceId());
627
        return $this;
628
    }
629
630
    public function orderByHistoricActivityInstanceId(): HistoricTaskInstanceQueryImpl
631
    {
632
        if ($this->isOrQueryActive) {
633
            throw new ProcessEngineException("Invalid query usage: cannot set orderByHistoricActivityInstanceId() within 'or' query");
634
        }
635
636
        $this->orderBy(HistoricTaskInstanceQueryProperty::activityInstanceId());
637
        return $this;
638
    }
639
640
    public function orderByProcessDefinitionId(): HistoricTaskInstanceQueryImpl
641
    {
642
        if ($this->isOrQueryActive) {
643
            throw new ProcessEngineException("Invalid query usage: cannot set orderByProcessDefinitionId() within 'or' query");
644
        }
645
646
        $this->orderBy(HistoricTaskInstanceQueryProperty::processDefinitionId());
647
        return $this;
648
    }
649
650
    public function orderByProcessInstanceId(): HistoricTaskInstanceQueryImpl
651
    {
652
        if ($this->isOrQueryActive) {
653
            throw new ProcessEngineException("Invalid query usage: cannot set orderByProcessInstanceId() within 'or' query");
654
        }
655
656
        $this->orderBy(HistoricTaskInstanceQueryProperty::processInstanceId());
657
        return $this;
658
    }
659
660
    public function orderByExecutionId(): HistoricTaskInstanceQueryImpl
661
    {
662
        if ($this->isOrQueryActive) {
663
            throw new ProcessEngineException("Invalid query usage: cannot set orderByExecutionId() within 'or' query");
664
        }
665
666
        $this->orderBy(HistoricTaskInstanceQueryProperty::executionId());
667
        return $this;
668
    }
669
670
    public function orderByHistoricTaskInstanceDuration(): HistoricTaskInstanceQueryImpl
671
    {
672
        if ($this->isOrQueryActive) {
673
            throw new ProcessEngineException("Invalid query usage: cannot set orderByHistoricTaskInstanceDuration() within 'or' query");
674
        }
675
676
        $this->orderBy(HistoricTaskInstanceQueryProperty::duration());
677
        return $this;
678
    }
679
680
    public function orderByHistoricTaskInstanceEndTime(): HistoricTaskInstanceQueryImpl
681
    {
682
        if ($this->isOrQueryActive) {
683
            throw new ProcessEngineException("Invalid query usage: cannot set orderByHistoricTaskInstanceEndTime() within 'or' query");
684
        }
685
686
        $this->orderBy(HistoricTaskInstanceQueryProperty::end());
687
        return $this;
688
    }
689
690
    public function orderByHistoricActivityInstanceStartTime(): HistoricTaskInstanceQueryImpl
691
    {
692
        if ($this->isOrQueryActive) {
693
            throw new ProcessEngineException("Invalid query usage: cannot set orderByHistoricActivityInstanceStartTime() within 'or' query");
694
        }
695
696
        $this->orderBy(HistoricTaskInstanceQueryProperty::start());
697
        return $this;
698
    }
699
700
    public function orderByTaskName(): HistoricTaskInstanceQueryImpl
701
    {
702
        if ($this->isOrQueryActive) {
703
            throw new ProcessEngineException("Invalid query usage: cannot set orderByTaskName() within 'or' query");
704
        }
705
706
        $this->orderBy(HistoricTaskInstanceQueryProperty::taskName());
707
        return $this;
708
    }
709
710
    public function orderByTaskDescription(): HistoricTaskInstanceQueryImpl
711
    {
712
        if ($this->isOrQueryActive) {
713
            throw new ProcessEngineException("Invalid query usage: cannot set orderByTaskDescription() within 'or' query");
714
        }
715
716
        $this->orderBy(HistoricTaskInstanceQueryProperty::taskDescription());
717
        return $this;
718
    }
719
720
    public function orderByTaskAssignee(): HistoricTaskInstanceQueryInterface
721
    {
722
        if ($this->isOrQueryActive) {
723
            throw new ProcessEngineException("Invalid query usage: cannot set orderByTaskAssignee() within 'or' query");
724
        }
725
726
        $this->orderBy(HistoricTaskInstanceQueryProperty::taskAssignee());
727
        return $this;
728
    }
729
730
    public function orderByTaskOwner(): HistoricTaskInstanceQueryInterface
731
    {
732
        if ($this->isOrQueryActive) {
733
            throw new ProcessEngineException("Invalid query usage: cannot set orderByTaskOwner() within 'or' query");
734
        }
735
736
        $this->orderBy(HistoricTaskInstanceQueryProperty::taskOwner());
737
        return $this;
738
    }
739
740
    public function orderByTaskDueDate(): HistoricTaskInstanceQueryInterface
741
    {
742
        if ($this->isOrQueryActive) {
743
            throw new ProcessEngineException("Invalid query usage: cannot set orderByTaskDueDate() within 'or' query");
744
        }
745
746
        $this->orderBy(HistoricTaskInstanceQueryProperty::taskDueDate());
747
        return $this;
748
    }
749
750
    public function orderByTaskFollowUpDate(): HistoricTaskInstanceQueryInterface
751
    {
752
        if ($this->isOrQueryActive) {
753
            throw new ProcessEngineException("Invalid query usage: cannot set orderByTaskFollowUpDate() within 'or' query");
754
        }
755
756
        $this->orderBy(HistoricTaskInstanceQueryProperty::taskFollowUpDate());
757
        return $this;
758
    }
759
760
    public function orderByDeleteReason(): HistoricTaskInstanceQueryImpl
761
    {
762
        if ($this->isOrQueryActive) {
763
            throw new ProcessEngineException("Invalid query usage: cannot set orderByDeleteReason() within 'or' query");
764
        }
765
766
        $this->orderBy(HistoricTaskInstanceQueryProperty::deleteReason());
767
        return $this;
768
    }
769
770
    public function orderByTaskDefinitionKey(): HistoricTaskInstanceQueryInterface
771
    {
772
        if ($this->isOrQueryActive) {
773
            throw new ProcessEngineException("Invalid query usage: cannot set orderByTaskDefinitionKey() within 'or' query");
774
        }
775
776
        $this->orderBy(HistoricTaskInstanceQueryProperty::taskDefinitionKey());
777
        return $this;
778
    }
779
780
    public function orderByTaskPriority(): HistoricTaskInstanceQueryInterface
781
    {
782
        if ($this->isOrQueryActive) {
783
            throw new ProcessEngineException("Invalid query usage: cannot set orderByTaskPriority() within 'or' query");
784
        }
785
786
        $this->orderBy(HistoricTaskInstanceQueryProperty:: taskPriority());
787
        return $this;
788
    }
789
790
    /*public HistoricTaskInstanceQueryInterface orderByCaseDefinitionId() {
791
        if ($this->isOrQueryActive) {
792
            throw new ProcessEngineException("Invalid query usage: cannot set orderByCaseDefinitionId() within 'or' query");
793
        }
794
795
        $this->orderBy(HistoricTaskInstanceQueryProperty.CASE_DEFINITION_ID);
796
        return $this;
797
    }
798
799
    public HistoricTaskInstanceQueryInterface orderByCaseInstanceId() {
800
        if ($this->isOrQueryActive) {
801
            throw new ProcessEngineException("Invalid query usage: cannot set orderByCaseInstanceId() within 'or' query");
802
        }
803
804
        $this->orderBy(HistoricTaskInstanceQueryProperty.CASE_INSTANCE_ID);
805
        return $this;
806
    }
807
808
    public function orderByCaseExecutionId(): HistoricTaskInstanceQueryInterface
809
    {
810
        if ($this->isOrQueryActive) {
811
            throw new ProcessEngineException("Invalid query usage: cannot set orderByCaseExecutionId() within 'or' query");
812
        }
813
        $this->orderBy(HistoricTaskInstanceQueryProperty.CASE_EXECUTION_ID);
814
        return $this;
815
    }*/
816
817
    public function orderByTenantId(): HistoricTaskInstanceQueryInterface
818
    {
819
        if ($this->isOrQueryActive) {
820
            throw new ProcessEngineException("Invalid query usage: cannot set orderByTenantId() within 'or' query");
821
        }
822
        return $this->orderBy(HistoricTaskInstanceQueryProperty::tenantId());
823
    }
824
825
    // getters and setters //////////////////////////////////////////////////////
826
827
    public function getProcessInstanceId(): string
828
    {
829
        return $this->processInstanceId;
830
    }
831
832
    public function getProcessInstanceBusinessKey(): string
833
    {
834
        return $this->processInstanceBusinessKey;
835
    }
836
837
    public function getProcessInstanceBusinessKeys(): array
838
    {
839
        return $this->processInstanceBusinessKeys;
840
    }
841
842
    public function getProcessInstanceBusinessKeyLike(): string
843
    {
844
        return $this->processInstanceBusinessKeyLike;
845
    }
846
847
    public function getProcessDefinitionKey(): string
848
    {
849
        return $this->processDefinitionKey;
850
    }
851
852
    public function getProcessDefinitionName(): string
853
    {
854
        return $this->processDefinitionName;
855
    }
856
857
    public function getExecutionId(): string
858
    {
859
        return $this->executionId;
860
    }
861
862
    public function getActivityInstanceIds(): array
863
    {
864
        return $this->activityInstanceIds;
865
    }
866
867
    public function getProcessDefinitionId(): string
868
    {
869
        return $this->processDefinitionId;
870
    }
871
872
    public function isAssigned(): bool
873
    {
874
        return $this->assigned;
875
    }
876
877
    public function isUnassigned(): bool
878
    {
879
        return $this->unassigned;
880
    }
881
882
    public function isWithCandidateGroups(): bool
883
    {
884
        return $this->withCandidateGroups;
885
    }
886
887
    public function isWithoutCandidateGroups(): bool
888
    {
889
        return $this->withoutCandidateGroups;
890
    }
891
892
    public function isFinished(): bool
893
    {
894
        return $this->finished;
895
    }
896
897
    public function isProcessFinished(): bool
898
    {
899
        return $this->processFinished;
900
    }
901
902
    public function isUnfinished(): bool
903
    {
904
        return $this->unfinished;
905
    }
906
907
    public function isProcessUnfinished(): bool
908
    {
909
        return $this->processUnfinished;
910
    }
911
912
    public function getDueDate(): string
913
    {
914
        return $this->dueDate;
915
    }
916
917
    public function getDueBefore(): string
918
    {
919
        return $this->dueBefore;
920
    }
921
922
    public function getDueAfter(): string
923
    {
924
        return $this->dueAfter;
925
    }
926
927
    public function isWithoutTaskDueDate(): bool
928
    {
929
        return $this->isWithoutTaskDueDate;
930
    }
931
932
    public function getFollowUpDate(): string
933
    {
934
        return $this->followUpDate;
935
    }
936
937
    public function getFollowUpBefore(): string
938
    {
939
        return $this->followUpBefore;
940
    }
941
942
    public function getFollowUpAfter(): string
943
    {
944
        return $this->followUpAfter;
945
    }
946
947
    public function getTaskName(): string
948
    {
949
        return $this->taskName;
950
    }
951
952
    public function getTaskNameLike(): string
953
    {
954
        return $this->taskNameLike;
955
    }
956
957
    public function getTaskDescription(): string
958
    {
959
        return $this->taskDescription;
960
    }
961
962
    public function getTaskDescriptionLike(): string
963
    {
964
        return $this->taskDescriptionLike;
965
    }
966
967
    public function getTaskDeleteReason(): string
968
    {
969
        return $this->taskDeleteReason;
970
    }
971
972
    public function getTaskDeleteReasonLike(): string
973
    {
974
        return $this->taskDeleteReasonLike;
975
    }
976
977
    public function getTaskAssignee(): string
978
    {
979
        return $this->taskAssignee;
980
    }
981
982
    public function getTaskAssigneeLike(): string
983
    {
984
        return $this->taskAssigneeLike;
985
    }
986
987
    public function getTaskId(): string
988
    {
989
        return $this->taskId;
990
    }
991
992
    public function getTaskInvolvedGroup(): string
993
    {
994
        return $this->taskInvolvedGroup;
995
    }
996
997
    public function getTaskInvolvedUser(): string
998
    {
999
        return $this->taskInvolvedUser;
1000
    }
1001
1002
    public function getTaskHadCandidateGroup(): string
1003
    {
1004
        return $this->taskHadCandidateGroup;
1005
    }
1006
1007
    public function getTaskHadCandidateUser(): string
1008
    {
1009
        return $this->taskHadCandidateUser;
1010
    }
1011
1012
    public function getTaskDefinitionKeys(): array
1013
    {
1014
        return $this->taskDefinitionKeys;
1015
    }
1016
1017
    public function getVariables(): array
1018
    {
1019
        return $this->variables;
1020
    }
1021
1022
    public function getVariableNamesIgnoreCase(): bool
1023
    {
1024
        return $this->variableNamesIgnoreCase;
1025
    }
1026
1027
    public function getVariableValuesIgnoreCase(): bool
1028
    {
1029
        return $this->variableValuesIgnoreCase;
1030
    }
1031
1032
    public function getTaskOwnerLike(): string
1033
    {
1034
        return $this->taskOwnerLike;
1035
    }
1036
1037
    public function getTaskOwner(): string
1038
    {
1039
        return $this->taskOwner;
1040
    }
1041
1042
    public function getTaskPriority(): int
1043
    {
1044
        return $this->taskPriority;
1045
    }
1046
1047
    public function getTaskParentTaskId(): string
1048
    {
1049
        return $this->taskParentTaskId;
1050
    }
1051
1052
    public function getTenantIds(): array
1053
    {
1054
        return $this->tenantIds;
1055
    }
1056
1057
    /*public String getCaseDefinitionId() {
1058
        return caseDefinitionId;
1059
    }
1060
1061
    public String getCaseDefinitionKey() {
1062
        return caseDefinitionKey;
1063
    }
1064
1065
    public String getCaseDefinitionName() {
1066
        return caseDefinitionName;
1067
    }
1068
1069
    public String getCaseInstanceId() {
1070
        return caseInstanceId;
1071
    }
1072
1073
    public function getCaseExecutionId(): string
1074
    {
1075
        return caseExecutionId;
1076
    }*/
1077
1078
    public function getFinishedAfter(): string
1079
    {
1080
        return $this->finishedAfter;
1081
    }
1082
1083
    public function getFinishedBefore(): string
1084
    {
1085
        return $this->finishedBefore;
1086
    }
1087
1088
    public function getStartedAfter(): string
1089
    {
1090
        return $this->startedAfter;
1091
    }
1092
1093
    public function getStartedBefore(): string
1094
    {
1095
        return $this->startedBefore;
1096
    }
1097
1098
    public function isTenantIdSet(): bool
1099
    {
1100
        return $this->isTenantIdSet;
1101
    }
1102
1103
    public function getQueries(): array
1104
    {
1105
        return $this->queries;
1106
    }
1107
1108
    public function isOrQueryActive(): bool
1109
    {
1110
        return $this->isOrQueryActive;
1111
    }
1112
1113
    public function addOrQuery(HistoricTaskInstanceQueryImpl $orQuery): void
1114
    {
1115
        $orQuery->isOrQueryActive = true;
1116
        $this->queries[] = $orQuery;
1117
    }
1118
1119
    public function setOrQueryActive(): void
1120
    {
1121
        $this->isOrQueryActive = true;
1122
    }
1123
1124
    public function or(): HistoricTaskInstanceQueryInterface
1125
    {
1126
        if ($this != $this->queries[0]) {
1127
            throw new ProcessEngineException("Invalid query usage: cannot set or() within 'or' query");
1128
        }
1129
1130
        $orQuery = new HistoricTaskInstanceQueryImpl();
0 ignored issues
show
Bug introduced by
The call to Jabe\Impl\HistoricTaskIn...ueryImpl::__construct() has too few arguments starting with commandExecutor. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

1130
        $orQuery = /** @scrutinizer ignore-call */ new HistoricTaskInstanceQueryImpl();

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
1131
        $orQuery->isOrQueryActive = true;
1132
        $orQuery->queries = $this->queries;
1133
        $this->queries[] = $orQuery;
1134
        return $orQuery;
1135
    }
1136
1137
    public function endOr(): HistoricTaskInstanceQueryInterface
1138
    {
1139
        if (!empty($this->queries) && $this != $this->queries[count($this->queries) - 1]) {
1140
            throw new ProcessEngineException("Invalid query usage: cannot set endOr() before or()");
1141
        }
1142
        return $this->queries[0];
1143
    }
1144
}
1145