Completed
Push — master ( 8a7993...1a063d )
by Nikola
05:00
created

Profile::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 19
ccs 0
cts 19
cp 0
rs 9.4286
cc 1
eloc 17
nc 1
nop 8
crap 2

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
 * This file is part of the Backup package, an RunOpenCode project.
4
 *
5
 * (c) 2015 RunOpenCode
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * This project is fork of "kbond/php-backup", for full credits info, please
11
 * view CREDITS file that was distributed with this source code.
12
 */
13
namespace RunOpenCode\Backup\Backup;
14
15
use RunOpenCode\Backup\Contract\DestinationInterface;
16
use RunOpenCode\Backup\Contract\NamerInterface;
17
use RunOpenCode\Backup\Contract\ProcessorInterface;
18
use RunOpenCode\Backup\Contract\ProfileInterface;
19
use RunOpenCode\Backup\Contract\RotatorInterface;
20
use RunOpenCode\Backup\Contract\SourceInterface;
21
use RunOpenCode\Backup\Contract\WorkflowInterface;
22
23
/**
24
 * Class Profile
25
 *
26
 * Backup profile.
27
 *
28
 * @package RunOpenCode\Backup\Backup
29
 */
30
final class Profile implements ProfileInterface
31
{
32
    /**
33
     * @var string
34
     */
35
    private $name;
36
37
    /**
38
     * @var SourceInterface
39
     */
40
    private $source;
41
42
    /**
43
     * @var ProcessorInterface
44
     */
45
    private $processor;
46
47
    /**
48
     * @var NamerInterface
49
     */
50
    private $namer;
51
52
    /**
53
     * @var RotatorInterface
54
     */
55
    private $preRotator;
56
57
    /**
58
     * @var DestinationInterface
59
     */
60
    private $destination;
61
62
    /**
63
     * @var RotatorInterface
64
     */
65
    private $postRotator;
66
67
    private $workflow;
68
69
    public function __construct(
70
        $name,
71
        SourceInterface $source,
72
        ProcessorInterface $processor,
73
        NamerInterface $namer,
74
        RotatorInterface $preRotator,
75
        DestinationInterface $destination,
76
        RotatorInterface $postRotator,
77
        WorkflowInterface $workflow
78
    ) {
79
        $this->name = $name;
80
        $this->source = $source;
81
        $this->processor = $processor;
82
        $this->namer = $namer;
83
        $this->preRotator = $preRotator;
84
        $this->destination = $destination;
85
        $this->postRotator = $postRotator;
86
        $this->workflow = $workflow;
87
    }
88
89
    /**
90
     * {@inheritdoc}
91
     */
92
    public function getName()
93
    {
94
        return $this->name;
95
    }
96
97
    /**
98
     * {@inheritdoc}
99
     */
100
    public function getSource()
101
    {
102
        return $this->source;
103
    }
104
105
    /**
106
     * {@inheritdoc}
107
     */
108
    public function getProcessor()
109
    {
110
        return $this->processor;
111
    }
112
113
    /**
114
     * {@inheritdoc}
115
     */
116
    public function getNamer()
117
    {
118
        return $this->namer;
119
    }
120
121
    /**
122
     * {@inheritdoc}
123
     */
124
    public function getPreRotator()
125
    {
126
        return $this->preRotator;
127
    }
128
129
    /**
130
     * {@inheritdoc}
131
     */
132
    public function getDestination()
133
    {
134
        return $this->destination;
135
    }
136
137
    /**
138
     * {@inheritdoc}
139
     */
140
    public function getPostRotator()
141
    {
142
        return $this->postRotator;
143
    }
144
145
    /**
146
     * {@inheritdoc}
147
     */
148
    public function getWorkflow()
149
    {
150
        return $this->workflow;
151
    }
152
}
153