Passed
Push — main ( a8b0f9...5ab65b )
by Vasil
03:25
created

Office::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 9
dl 0
loc 28
ccs 0
cts 1
cp 0
crap 2
rs 10
c 0
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 VasilDakov\Econt\Model;
6
7
use JMS\Serializer\Annotation as Serializer;
8
9
readonly class Office
10
{
11
    public function __construct(
12
        #[Serializer\Type('int')]
13
        public ?int $id = null,
14
15
        #[Serializer\Type('string')]
16
        public ?string $code = null,
17
18
        #[Serializer\Type('string')]
19
        public ?string $name = null,
20
21
        #[Serializer\Type('string')]
22
        public ?string $nameEn = null,
23
24
        #[Serializer\Type('bool')]
25
        public ?bool $isMPS = null,
26
27
        #[Serializer\Type('bool')]
28
        public ?bool $isAPS = null,
29
30
        #[Serializer\Type('array')]
31
        public ?array $phones = null,
32
33
        #[Serializer\Type('array')]
34
        public ?array $emails = null,
35
36
        #[Serializer\Type(Address::class)]
37
        public ?Address $address = null,
0 ignored issues
show
Bug introduced by
The type VasilDakov\Econt\Model\Address 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
    }
40
}
41