FuseConnInfo::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

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

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
/**
4
 * This file is part of the sj-i/php-fuse package.
5
 *
6
 * (c) sji <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Fuse\Libc\Fuse;
15
16
use FFI\CData;
17
use Fuse\FFI\TypedCDataDefaultImplementationTrait;
18
use TypedCData\TypedCDataInterface;
0 ignored issues
show
Bug introduced by
The type TypedCData\TypedCDataInterface 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...
19
20
/**
21
 * struct fuse_conn_info
22
 * {
23
 *     unsigned proto_major;
24
 *     unsigned proto_minor;
25
 *     unsigned async_read;
26
 *     unsigned max_write;
27
 *     unsigned max_readahead;
28
 *     unsigned capable;
29
 *     unsigned want;
30
 *     unsigned max_background;
31
 *     unsigned congestion_threshold;
32
 *     unsigned reserved[23];
33
 * };
34
 */
35
final class FuseConnInfo implements TypedCDataInterface
36
{
37
    use TypedCDataDefaultImplementationTrait;
38
39
    public int $proto_major;
40
    public int $proto_minor;
41
    public int $async_read;
42
    public int $max_write;
43
    public int $max_readahead;
44
    public int $capable;
45
    public int $want;
46
    public int $max_background;
47
    public int $congestion_threshold;
48
    public ?CData $reserved;
49
50
    public static function getCTypeName(): string
51
    {
52
        return 'struct fuse_conn_info';
53
    }
54
55
    public function __construct(
56
        int $proto_major = 0,
57
        int $proto_minor = 0,
58
        int $async_read = 0,
59
        int $max_write = 0,
60
        int $max_readahead = 0,
61
        int $capable = 0,
62
        int $want = 0,
63
        int $max_background = 0,
64
        int $congestion_threshold = 0,
65
        ?CData $reserved = null
66
    ) {
67
        $this->proto_major = $proto_major;
68
        $this->proto_minor = $proto_minor;
69
        $this->async_read = $async_read;
70
        $this->max_write = $max_write;
71
        $this->max_readahead = $max_readahead;
72
        $this->capable = $capable;
73
        $this->want = $want;
74
        $this->max_background = $max_background;
75
        $this->congestion_threshold = $congestion_threshold;
76
        $this->reserved = $reserved;
77
    }
78
}
79