Test Failed
Push — master ( 2c2c87...ed1c51 )
by Chris
25:05 queued 37s
created

Setting::__construct()   A

Complexity

Conditions 6
Paths 32

Size

Total Lines 19
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 19
rs 9.2222
cc 6
nc 32
nop 8

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
namespace Leonidas\Library\Admin\Setting;
4
5
use Leonidas\Contracts\Admin\Setting\SettingHandlerInterface;
6
use Leonidas\Contracts\Admin\Setting\SettingInterface;
7
use Leonidas\Library\Admin\Setting\Traits\HasSettingsTrait;
0 ignored issues
show
Bug introduced by
The type Leonidas\Library\Admin\S...Traits\HasSettingsTrait 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...
8
9
class Setting implements SettingInterface
10
{
11
    use HasSettingsTrait;
12
13
    public function __construct(
14
        string $optionGroup,
15
        string $optionName,
16
        ?string $type = null,
17
        ?string $description = null,
18
        ?SettingHandlerInterface $handler = null,
19
        $restSchema = null,
20
        $defaultValue = null,
21
        ?array $extraArgs = null
22
    ) {
23
        $this->optionGroup = $optionGroup;
0 ignored issues
show
Bug Best Practice introduced by
The property optionGroup does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
24
        $this->optionName = $optionName;
0 ignored issues
show
Bug Best Practice introduced by
The property optionName does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
25
        $this->handler = $handler;
0 ignored issues
show
Bug Best Practice introduced by
The property handler does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
26
27
        $type && $this->type = $type;
0 ignored issues
show
Bug Best Practice introduced by
The property type does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
28
        $description && $this->description = $description;
0 ignored issues
show
Bug Best Practice introduced by
The property description does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
29
        $restSchema && $this->restSchema = $restSchema;
0 ignored issues
show
Bug Best Practice introduced by
The property restSchema does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
30
        $defaultValue && $this->defaultValue = $defaultValue;
0 ignored issues
show
Bug Best Practice introduced by
The property defaultValue does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
31
        $extraArgs && $this->extraArgs = $extraArgs;
0 ignored issues
show
Bug Best Practice introduced by
The property extraArgs does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
32
    }
33
}
34