Passed
Push — master ( 2aad05...4fe473 )
by Yo
02:45
created

UpdateConfiguration   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 29
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A run() 0 10 1
1
<?php
2
namespace Yoanm\ComposerConfigManager\Application;
3
4
use Yoanm\ComposerConfigManager\Application\Updater\ConfigurationUpdater;
5
use Yoanm\ComposerConfigManager\Application\Writer\ConfigurationWriterInterface;
6
7
class UpdateConfiguration
8
{
9
    /** @var ConfigurationWriterInterface */
10
    private $configurationWriter;
11
    /** @var ConfigurationUpdater */
12
    private $configurationUpdater;
13
14
    /**
15
     * @param ConfigurationWriterInterface $configurationWriter
16
     * @param ConfigurationUpdater         $configurationUpdater
17
     */
18 1
    public function __construct(
19
        ConfigurationWriterInterface $configurationWriter,
20
        ConfigurationUpdater $configurationUpdater
21
    ) {
22 1
        $this->configurationWriter = $configurationWriter;
23 1
        $this->configurationUpdater = $configurationUpdater;
24 1
    }
25 1
    public function run(UpdateConfigurationRequest $request)
26
    {
27 1
        $this->configurationWriter->write(
28 1
            $this->configurationUpdater->update(
29 1
                $request->getBaseConfiguration(),
30 1
                $request->getNewConfiguration()
31 1
            ),
32 1
            $request->getDestinationFolder()
33 1
        );
34 1
    }
35
}
36