Completed
Pull Request — master (#10)
by Tomáš
06:04 queued 03:12
created

MemorySource::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 23
ccs 12
cts 12
cp 1
rs 9.0856
c 0
b 0
f 0
cc 1
eloc 21
nc 1
nop 10
crap 1

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 a part of Sculpin.
5
 *
6
 * (c) Dragonfly Development Inc.
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
namespace Symplify\PHP7_Sculpin\Source;
13
14
use Dflydev\DotAccessConfiguration\Configuration as Data;
15
16
final class MemorySource extends AbstractSource
17
{
18
    /**
19
     * Constructor.
20
     *
21
     * @param string       $sourceId         Source ID
22
     * @param Data         $data             Data
23
     * @param string       $content          Content
24
     * @param string       $formattedContent Formatted content
25
     * @param string       $relativePathname Relative Pathname
26
     * @param string       $filename         Filename
27
     * @param \SplFileInfo $file             File
28
     * @param bool         $isRaw            Is raw?
29
     * @param bool         $canBeFormatted   Can be formatted?
30
     * @param bool         $hasChanged       Has changed?
31
     */
32 4
    public function __construct(
33
        $sourceId,
34
        Data $data,
35
        $content,
36
        $formattedContent,
37
        $relativePathname,
38
        $filename,
39
        $file,
40
        $isRaw,
41
        $canBeFormatted,
42
        $hasChanged
43
    ) {
44 4
        $this->sourceId = $sourceId;
45 4
        $this->data = $data;
46 4
        $this->content = $content;
47 4
        $this->formattedContent = $formattedContent;
48 4
        $this->relativePathname = $relativePathname;
49 4
        $this->filename = $filename;
50 4
        $this->file = $file;
51 4
        $this->isRaw = $isRaw;
52 4
        $this->canBeFormatted = $canBeFormatted;
53 4
        $this->hasChanged = $hasChanged;
54 4
    }
55
}
56