Issues (2551)

src/Impl/Cmd/FindActiveActivityIdsCmd.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Jabe\Impl\Cmd;
4
5
use Jabe\Impl\Interceptor\{
6
    CommandInterface,
7
    CommandContext
8
};
9
use Jabe\Impl\Persistence\Entity\{
10
    ExecutionEntity,
11
    ExecutionManager
12
};
13
use Jabe\Impl\Util\EnsureUtil;
14
15
class FindActiveActivityIdsCmd implements CommandInterface, \Serializable
16
{
17
    protected $executionId;
18
19
    public function __construct(string $executionId)
20
    {
21
        $this->executionId = $executionId;
22
    }
23
24
    public function serialize()
25
    {
26
        return json_encode([
27
            'executionId' => $this->executionId
28
        ]);
29
    }
30
31
    public function unserialize($data)
32
    {
33
        $json = json_decode($data);
34
        $this->executionId = $json->executionId;
35
    }
36
37
    public function execute(CommandContext $commandContext)
38
    {
39
        EnsureUtil::ensureNotNull("executionId", "executionId", $this->executionId);
40
41
        // fetch execution
42
        $executionManager = $commandContext->getExecutionManager();
43
        $execution = $executionManager->findExecutionById($this->executionId);
44
        EnsureUtil::ensureNotNull("execution " . $this->executionId . " doesn't exist", "execution", $execution);
45
46
        $this->checkGetActivityIds($execution, $commandContext);
47
48
        // fetch active activities
49
        return $execution->findActiveActivityIds();
50
    }
51
52
    protected function checkGetActivityIds(ExecutionEntity $execution, CommandContext $commandContext): void
53
    {
54
        foreach ($commandContext->getProcessEngineConfiguration()->getCommandCheckers() as $checker) {
0 ignored issues
show
The method getCommandCheckers() 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

54
        foreach ($commandContext->getProcessEngineConfiguration()->/** @scrutinizer ignore-call */ getCommandCheckers() as $checker) {

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...
55
            $checker->checkReadProcessInstance($execution);
56
        }
57
    }
58
}
59