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

FilterServiceImpl::createFilterQuery()   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\{
6
    EntityTypes,
7
    FilterServiceInterface
8
};
9
use Jabe\Engine\Filter\{
10
    FilterInterface,
11
    FilterQueryInterface
12
};
13
use Jabe\Engine\Impl\Cmd\{
14
    CreateFilterCmd,
15
    DeleteFilterCmd,
16
    ExecuteFilterCountCmd,
17
    ExecuteFilterListCmd,
18
    ExecuteFilterListPageCmd,
19
    ExecuteFilterSingleResultCmd,
0 ignored issues
show
Bug introduced by
The type Jabe\Engine\Impl\Cmd\ExecuteFilterSingleResultCmd 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...
20
    GetFilterCmd,
21
    SaveFilterCmd
22
};
23
use Jabe\Engine\Impl\Filter\FilterQueryImpl;
24
use Jabe\Engine\Query\QueryInterface;
25
26
class FilterServiceImpl extends ServiceImpl implements FilterServiceInterface
27
{
28
    public function newTaskFilter(string $filterName = null): FilterInterface
29
    {
30
        $filter = $this->commandExecutor->execute(new CreateFilterCmd(EntityTypes::TASK));
31
        if ($filterName !== null) {
32
            $filter->setName($filterName);
33
        }
34
        return $filter;
35
    }
36
37
    public function createFilterQuery(): FilterQueryIntefrace
0 ignored issues
show
Bug introduced by
The type Jabe\Engine\Impl\FilterQueryIntefrace 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...
38
    {
39
        return new FilterQueryImpl($this->commandExecutor);
0 ignored issues
show
Bug Best Practice introduced by
The expression return new Jabe\Engine\I...$this->commandExecutor) returns the type Jabe\Engine\Impl\Filter\FilterQueryImpl which is incompatible with the type-hinted return Jabe\Engine\Impl\FilterQueryIntefrace.
Loading history...
40
    }
41
42
    public function createTaskFilterQuery(): FilterQueryInterface
43
    {
44
        return (new FilterQueryImpl($this->commandExecutor))->filterResourceType(EntityTypes::TASK);
45
    }
46
47
    public function saveFilter(FilterInterface $filter): FilterInterface
48
    {
49
        return $this->commandExecutor->execute(new SaveFilterCmd($filter));
50
    }
51
52
    public function getFilter(string $filterId): FilterInterface
53
    {
54
        return $this->commandExecutor->execute(new GetFilterCmd($filterId));
55
    }
56
57
    public function deleteFilter(string $filterId): void
58
    {
59
        $this->commandExecutor->execute(new DeleteFilterCmd($filterId));
60
    }
61
62
    public function list(string $filterId, ?QueryInterface $extendingQuery = null): array
63
    {
64
        return $this->commandExecutor->execute(new ExecuteFilterListCmd($filterId, $extendingQuery));
65
    }
66
67
    public function listPage(string $filterId, ?QueryInterface $extendingQuery, int $firstResult, int $maxResults): array
68
    {
69
        return $this->commandExecutor->execute(new ExecuteFilterListPageCmd($filterId, $extendingQuery, $firstResult, $maxResults));
70
    }
71
72
    public function singleResult(string $filterId, ?QueryInterface $extendingQuery = null)
73
    {
74
        return $this->commandExecutor->execute(new ExecuteFilterSingleResultCmd($filterId, $extendingQuery));
75
    }
76
77
    public function count(string $filterId, ?QueryInterface $extendingQuery = null): int
78
    {
79
        return $this->commandExecutor->execute(new ExecuteFilterCountCmd($filterId, $extendingQuery));
80
    }
81
}
82