PreCommitExecuteStub::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
cc 1
nc 1
nop 9

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 PhpGitHooks\Module\Configuration\Tests\Stub;
4
5
use PhpGitHooks\Module\Configuration\Domain\Composer;
6
use PhpGitHooks\Module\Configuration\Domain\Execute;
7
use PhpGitHooks\Module\Configuration\Domain\JsonLint;
8
use PhpGitHooks\Module\Configuration\Domain\PhpCs;
9
use PhpGitHooks\Module\Configuration\Domain\PhpCsFixer;
10
use PhpGitHooks\Module\Configuration\Domain\PhpLint;
11
use PhpGitHooks\Module\Configuration\Domain\PhpMd;
12
use PhpGitHooks\Module\Configuration\Domain\PhpUnit;
13
use PhpGitHooks\Module\Configuration\Domain\PhpUnitGuardCoverage;
14
use PhpGitHooks\Module\Configuration\Domain\PhpUnitStrictCoverage;
15
16
class PreCommitExecuteStub
17
{
18
    /**
19
     * @param Composer              $composer
20
     * @param JsonLint              $jsonLint
21
     * @param PhpLint               $phpLint
22
     * @param PhpMd                 $phpMd
23
     * @param PhpCs                 $phpCs
24
     * @param PhpCsFixer            $phpCsFixer
25
     * @param PhpUnit               $phpUnit
26
     * @param PhpUnitStrictCoverage $strictCoverage
27
     * @param PhpUnitGuardCoverage  $guardCoverage
28
     *
29
     * @return Execute
30
     */
31
    public static function create(
32
        Composer $composer,
33
        JsonLint $jsonLint,
34
        PhpLint $phpLint,
35
        PhpMd $phpMd,
36
        PhpCs $phpCs,
37
        PhpCsFixer $phpCsFixer,
38
        PhpUnit $phpUnit,
39
        PhpUnitStrictCoverage $strictCoverage,
40
        PhpUnitGuardCoverage $guardCoverage
41
    ) {
42
        return new Execute(
43
            [$composer, $jsonLint, $phpLint, $phpMd, $phpCs, $phpCsFixer, $phpUnit, $strictCoverage, $guardCoverage]
44
        );
45
    }
46
}
47