Test Failed
Push — main ( 5af89f...c76fcf )
by Bingo
05:51
created

isTenantIdSet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
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\ProcessEngineConfiguration;
6
use Jabe\Engine\Exception\NotValidException;
7
use Jabe\Engine\History\{
8
    CleanableHistoricProcessInstanceReportInterface,
9
    CleanableHistoricProcessInstanceReportResultInterface
10
};
11
use Jabe\Engine\Impl\Interceptor\{
12
    CommandContext,
13
    CommandExecutorInterface
14
};
15
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...
16
17
class CleanableHistoricProcessInstanceReportImpl extends AbstractQuery implements CleanableHistoricProcessInstanceReportInterface
18
{
19
    protected $processDefinitionIdIn = [];
20
    protected $processDefinitionKeyIn = [];
21
    protected $tenantIdIn = [];
22
    protected $isTenantIdSet = false;
23
    protected $isCompact = false;
24
25
    protected $currentTimestamp;
26
27
    protected $isHistoryCleanupStrategyRemovalTimeBased;
28
29
    public function __construct(CommandExecutorInterface $commandExecutor)
30
    {
31
        parent::__construct($commandExecutor);
32
    }
33
34
    public function processDefinitionIdIn(array $processDefinitionIds): CleanableHistoricProcessInstanceReportInterface
35
    {
36
        EnsureUtil::ensureNotNull(NotValidException::class, "processDefinitionIdIn", $processDefinitionIds);
37
        $this->processDefinitionIdIn = $processDefinitionIds;
38
        return $this;
39
    }
40
41
    public function processDefinitionKeyIn(array $processDefinitionKeys): CleanableHistoricProcessInstanceReportInterface
42
    {
43
        EnsureUtil::ensureNotNull(NotValidException::class, "processDefinitionKeyIn", $processDefinitionKeys);
44
        $this->processDefinitionKeyIn = $processDefinitionKeys;
45
        return $this;
46
    }
47
48
    public function tenantIdIn(array $tenantIds): CleanableHistoricProcessInstanceReportInterface
49
    {
50
        EnsureUtil::ensureNotNull(NotValidException::class, "tenantIdIn", $tenantIds);
51
        $this->tenantIdIn = $tenantIds;
52
        $this->isTenantIdSet = true;
53
        return $this;
54
    }
55
56
    public function withoutTenantId(): CleanableHistoricProcessInstanceReportInterface
57
    {
58
        $this->tenantIdIn = null;
59
        $this->isTenantIdSet = true;
60
        return $this;
61
    }
62
63
    public function compact(): CleanableHistoricProcessInstanceReportInterface
64
    {
65
        $this->isCompact = true;
66
        return $this;
67
    }
68
69
    public function orderByFinished(): CleanableHistoricProcessInstanceReportInterface
70
    {
71
        $this->orderBy(CleanableHistoricInstanceReportProperty::finishedAmount());
0 ignored issues
show
Bug Best Practice introduced by
The method Jabe\Engine\Impl\Cleanab...perty::finishedAmount() 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

71
        $this->orderBy(CleanableHistoricInstanceReportProperty::/** @scrutinizer ignore-call */ finishedAmount());
Loading history...
72
        return $this;
73
    }
74
75
    public function executeCount(CommandContext $commandContext): int
76
    {
77
        $this->provideHistoryCleanupStrategy($commandContext);
78
        $this->checkQueryOk();
79
        return $commandContext
80
            ->getHistoricProcessInstanceManager()
81
            ->findCleanableHistoricProcessInstancesReportCountByCriteria($this);
82
    }
83
84
    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...
85
    {
86
        $this->provideHistoryCleanupStrategy($commandContext);
87
        $this->checkQueryOk();
88
        return $commandContext
89
            ->getHistoricProcessInstanceManager()
90
            ->findCleanableHistoricProcessInstancesReportByCriteria($this, $page);
91
    }
92
93
    public function getCurrentTimestamp(): string
94
    {
95
        return $this->currentTimestamp;
96
    }
97
98
    public function setCurrentTimestamp(atring $currentTimestamp): void
0 ignored issues
show
Bug introduced by
The type Jabe\Engine\Impl\atring 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...
99
    {
100
        $this->currentTimestamp = $currentTimestamp;
101
    }
102
103
    public function getProcessDefinitionIdIn(): array
104
    {
105
        return $this->processDefinitionIdIn;
106
    }
107
108
    public function getProcessDefinitionKeyIn(): array
109
    {
110
        return $this->processDefinitionKeyIn;
111
    }
112
113
    public function getTenantIdIn(): array
114
    {
115
        return $this->tenantIdIn;
116
    }
117
118
    public function setTenantIdIn(array $tenantIdIn): void
119
    {
120
        $this->tenantIdIn = $tenantIdIn;
121
    }
122
123
    public function isTenantIdSet(): bool
124
    {
125
        return $this->isTenantIdSet;
126
    }
127
128
    public function isCompact(): bool
129
    {
130
        return $this->isCompact;
131
    }
132
133
    protected function provideHistoryCleanupStrategy(CommandContext $commandContext): void
134
    {
135
        $historyCleanupStrategy = $commandContext->getProcessEngineConfiguration()
136
            ->getHistoryCleanupStrategy();
0 ignored issues
show
Bug introduced by
The method getHistoryCleanupStrategy() does not exist on Jabe\Engine\Impl\Cfg\Pro...EngineConfigurationImpl. Did you maybe mean getHistory()? ( Ignorable by Annotation )

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

136
            ->/** @scrutinizer ignore-call */ getHistoryCleanupStrategy();

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...
137
        $this->isHistoryCleanupStrategyRemovalTimeBased = ProcessEngineConfiguration::HISTORY_CLEANUP_STRATEGY_REMOVAL_TIME_BASED == $historyCleanupStrategy;
138
    }
139
140
    public function isHistoryCleanupStrategyRemovalTimeBased(): bool
141
    {
142
        return $this->isHistoryCleanupStrategyRemovalTimeBased;
143
    }
144
}
145