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

GetDeployedTaskFormCmd::checkAuthorization()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Jabe\Engine\Impl;
4
5
use Jabe\Engine\BadUserRequestException;
6
use Jabe\Engine\Form\FormDataInterface;
7
use Jabe\Engine\Impl\Cmd\{
8
    AbstractGetDeployedFormCmd,
9
    GetTaskFormCmd
10
};
11
use Jabe\Engine\Impl\Persistence\Entity\TaskEntity;
12
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...
13
14
class GetDeployedTaskFormCmd extends AbstractGetDeployedFormCmd
15
{
16
    protected $taskId;
17
18
    public function __construct(string $taskId)
19
    {
20
        EnsureUtil::ensureNotNull("Task id cannot be null", "taskId", $taskId);
21
        $this->taskId = $taskId;
22
    }
23
24
    protected function getFormData(): FormDataInterface
25
    {
26
        return $this->commandContext->runWithoutAuthorization(new GetTaskFormCmd($this->taskId));
27
    }
28
29
    protected function checkAuthorization(): void
30
    {
31
        $taskEntity = $this->commandContext->getTaskManager()->findTaskById($this->taskId);
32
        foreach ($this->commandContext->getProcessEngineConfiguration()->getCommandCheckers() as $checker) {
33
            $checker->checkReadTask($taskEntity);
34
        }
35
    }
36
}
37