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

isIncludeCanceled()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Jabe\Engine\Impl;
4
5
use Jabe\Engine\History\HistoricActivityStatisticsQueryInterface;
6
use Jabe\Engine\Impl\Interceptor\{
7
    CommandContext,
8
    CommandExecutorInterface
9
};
10
use Jabe\Engine\Impl\Util\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...
11
12
class HistoricActivityStatisticsQueryImpl extends AbstractQuery implements HistoricActivityStatisticsQueryInterface
13
{
14
    protected $processDefinitionId;
15
16
    protected $includeFinished;
17
    protected $includeCanceled;
18
    protected $includeCompleteScope;
19
    protected $includeIncidents;
20
21
    protected $startedBefore;
22
    protected $startedAfter;
23
    protected $finishedBefore;
24
    protected $finishedAfter;
25
26
    protected $processInstanceIds = [];
27
28
    public function __construct(string $processDefinitionId, CommandExecutorInterface $commandExecutor)
29
    {
30
        parent::__construct($commandExecutor);
31
        $this->processDefinitionId = $processDefinitionId;
32
    }
33
34
    public function includeFinished(): HistoricActivityStatisticsQueryInterface
35
    {
36
        $this->includeFinished = true;
37
        return $this;
38
    }
39
40
    public function includeCanceled(): HistoricActivityStatisticsQueryInterface
41
    {
42
        $this->includeCanceled = true;
43
        return $this;
44
    }
45
46
    public function includeCompleteScope(): HistoricActivityStatisticsQueryInterface
47
    {
48
        $this->includeCompleteScope = true;
49
        return $this;
50
    }
51
52
    public function includeIncidents(): HistoricActivityStatisticsQueryInterface
53
    {
54
        $this->includeIncidents = true;
55
        return $this;
56
    }
57
58
    public function startedAfter(string $date): HistoricActivityStatisticsQueryInterface
59
    {
60
        $this->startedAfter = $date;
61
        return $this;
62
    }
63
64
    public function startedBefore(string $date): HistoricActivityStatisticsQueryInterface
65
    {
66
        $this->startedBefore = $date;
67
        return $this;
68
    }
69
70
    public function finishedAfter(string $date): HistoricActivityStatisticsQueryInterface
71
    {
72
        $this->finishedAfter = $date;
73
        return $this;
74
    }
75
76
    public function finishedBefore(string $date): HistoricActivityStatisticsQueryInterface
77
    {
78
        $this->finishedBefore = $date;
79
        return $this;
80
    }
81
82
    public function processInstanceIdIn(array $processInstanceIds): HistoricActivityStatisticsQueryInterface
83
    {
84
        EnsureUtil::ensureNotNull("processInstanceIds", "processInstanceIds", $processInstanceIds);
85
        $this->processInstanceIds = $processInstanceIds;
86
        return $this;
87
    }
88
89
    public function orderByActivityId(): HistoricActivityStatisticsQueryInterface
90
    {
91
        return $this->orderBy(HistoricActivityStatisticsQueryProperty::activityId());
0 ignored issues
show
Bug Best Practice introduced by
The method Jabe\Engine\Impl\Histori...yProperty::activityId() is not static, but was called statically. ( Ignorable by Annotation )

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

91
        return $this->orderBy(HistoricActivityStatisticsQueryProperty::/** @scrutinizer ignore-call */ activityId());
Loading history...
92
    }
93
94
    public function executeCount(CommandContext $commandContext): int
95
    {
96
        $this->checkQueryOk();
97
        return
98
            $commandContext
99
            ->getHistoricStatisticsManager()
100
            ->getHistoricStatisticsCountGroupedByActivity($this);
101
    }
102
103
    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...
104
    {
105
        $this->checkQueryOk();
106
        return
107
            $commandContext
108
            ->getHistoricStatisticsManager()
109
            ->getHistoricStatisticsGroupedByActivity($this, $page);
110
    }
111
112
    protected function checkQueryOk(): void
113
    {
114
        parent::checkQueryOk();
115
        EnsureUtil::ensureNotNull("No valid process definition id supplied", "processDefinitionId", $processDefinitionId);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $processDefinitionId seems to be never defined.
Loading history...
116
    }
117
118
    // getters /////////////////////////////////////////////////
119
120
    public function getProcessDefinitionId(): string
121
    {
122
        return $this->processDefinitionId;
123
    }
124
125
    public function isIncludeFinished(): bool
126
    {
127
        return $this->includeFinished;
128
    }
129
130
    public function isIncludeCanceled(): bool
131
    {
132
        return $this->includeCanceled;
133
    }
134
135
    public function isIncludeCompleteScope(): bool
136
    {
137
        return $this->includeCompleteScope;
138
    }
139
140
    public function getProcessInstanceIds(): array
141
    {
142
        return $this->processInstanceIds;
143
    }
144
145
    public function isIncludeIncidents(): bool
146
    {
147
        return $this->includeIncidents;
148
    }
149
}
150