Issues (2551)

src/Impl/Incident/IncidentHandling.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Jabe\Impl\Incident;
4
5
use Jabe\Impl\Context\Context;
6
use Jabe\Runtime\IncidentInterface;
7
8
class IncidentHandling
9
{
10
    public static function createIncident(
11
        string $incidentType,
12
        IncidentContext $context,
13
        string $message
14
    ): IncidentInterface {
15
        $handler = Context::getProcessEngineConfiguration()
16
            ->getIncidentHandler($incidentType);
0 ignored issues
show
The method getIncidentHandler() 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

16
            ->/** @scrutinizer ignore-call */ getIncidentHandler($incidentType);

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...
17
18
        if ($handler === null) {
19
            $handler = new DefaultIncidentHandler($incidentType);
20
        }
21
22
        return $handler->handleIncident($context, $message);
23
    }
24
25
    public static function removeIncidents(
26
        string $incidentType,
27
        IncidentContext $context,
28
        bool $incidentsResolved
29
    ): void {
30
        $handler = Context::getProcessEngineConfiguration()
31
            ->getIncidentHandler($incidentType);
32
33
        if ($handler === null) {
34
            $handler = new DefaultIncidentHandler($incidentType);
35
        }
36
37
        if ($incidentsResolved) {
38
            $handler->resolveIncident($context);
39
        } else {
40
            $handler->deleteIncident($context);
41
        }
42
    }
43
}
44