QueryBuilder::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
nc 1
nop 8
dl 0
loc 10
rs 10
c 1
b 0
f 0

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
declare(strict_types=1);
4
5
namespace ApiSkeletons\Doctrine\ORM\GraphQL\Event;
6
7
use Doctrine\ORM\QueryBuilder as DoctrineQueryBuilder;
8
use GraphQL\Type\Definition\ResolveInfo;
9
use League\Event\HasEventName;
10
use Override;
0 ignored issues
show
Bug introduced by
The type Override 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...
11
12
/**
13
 * This event is fired when the QueryBuilder is created for an entity
14
 */
15
class QueryBuilder implements
16
    HasEventName
17
{
18
    /** @param mixed[] $args */
19
    public function __construct(
20
        protected readonly string $eventName,
21
        protected readonly DoctrineQueryBuilder $queryBuilder,
22
        protected readonly int $offset,
23
        protected readonly int $limit,
24
        protected readonly mixed $objectValue,
25
        protected readonly array $args,
26
        protected readonly mixed $context,
27
        protected readonly ResolveInfo $info,
28
    ) {
29
    }
30
31
    #[Override]
32
    public function eventName(): string
33
    {
34
        return $this->eventName;
35
    }
36
37
    public function getQueryBuilder(): DoctrineQueryBuilder
38
    {
39
        return $this->queryBuilder;
40
    }
41
42
    public function getOffset(): int
43
    {
44
        return $this->offset;
45
    }
46
47
    public function getLimit(): int
48
    {
49
        return $this->limit;
50
    }
51
52
    public function getObjectValue(): mixed
53
    {
54
        return $this->objectValue;
55
    }
56
57
    /** @return mixed[] */
58
    public function getArgs(): array
59
    {
60
        return $this->args;
61
    }
62
63
    public function getContext(): mixed
64
    {
65
        return $this->context;
66
    }
67
68
    public function getInfo(): ResolveInfo
69
    {
70
        return $this->info;
71
    }
72
}
73