HistoryLevelActivity::isHistoryEventProduced()   D
last analyzed

Complexity

Conditions 19
Paths 19

Size

Total Lines 25
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 25
rs 4.5166
c 0
b 0
f 0
cc 19
nc 19
nop 2

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace Jabe\Impl\History;
4
5
use Jabe\ProcessEngineConfiguration;
6
use Jabe\Impl\History\Event\{
7
    HistoryEventTypeInterface,
8
    HistoryEventTypes
9
};
10
11
class HistoryLevelActivity extends AbstractHistoryLevel
12
{
13
    public function getId(): int
14
    {
15
        return 1;
16
    }
17
18
    public function getName(): string
19
    {
20
        return ProcessEngineConfiguration::HISTORY_ACTIVITY;
21
    }
22
23
    public function isHistoryEventProduced(HistoryEventTypeInterface $eventType, $entity): bool
24
    {
25
        return HistoryEventTypes::processInstanceStart()->equals($eventType)
0 ignored issues
show
Bug introduced by
The method equals() does not exist on Jabe\Impl\History\Event\HistoryEventTypeInterface. Since it exists in all sub-types, consider adding an abstract or default implementation to Jabe\Impl\History\Event\HistoryEventTypeInterface. ( Ignorable by Annotation )

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

25
        return HistoryEventTypes::processInstanceStart()->/** @scrutinizer ignore-call */ equals($eventType)
Loading history...
26
        || HistoryEventTypes::processInstanceUpdate()->equals($eventType)
27
        || HistoryEventTypes::processInstanceMigrate()->equals($eventType)
28
        || HistoryEventTypes::processInstanceEnd()->equals($eventType)
29
30
        || HistoryEventTypes::taskInstanceCreate()->equals($eventType)
31
        || HistoryEventTypes::taskInstanceUpdate()->equals($eventType)
32
        || HistoryEventTypes::taskInstanceMigrate()->equals($eventType)
33
        || HistoryEventTypes::taskInstanceComplete()->equals($eventType)
34
        || HistoryEventTypes::taskInstanceDelete()->equals($eventType)
35
36
        || HistoryEventTypes::activityInstanceStart()->equals($eventType)
37
        || HistoryEventTypes::activityInstanceUpdate()->equals($eventType)
38
        || HistoryEventTypes::activityInstanceMigrate()->equals($eventType)
39
        || HistoryEventTypes::activityInstanceEnd()->equals($eventType)
40
41
        || HistoryEventTypes::caseInstanceCreate()->equals($eventType)
42
        || HistoryEventTypes::caseInstanceUpdate()->equals($eventType)
43
        || HistoryEventTypes::caseInstanceClose()->equals($eventType)
44
45
        || HistoryEventTypes::caseActivityInstanceCreate()->equals($eventType)
46
        || HistoryEventTypes::caseActivityInstanceUpdate()->equals($eventType)
47
        || HistoryEventTypes::caseActivityInstanceEnd()->equals($eventType);
48
    }
49
}
50