|
1
|
|
|
<?php |
|
2
|
|
|
namespace Yoanm\ComposerConfigManager\Application; |
|
3
|
|
|
|
|
4
|
|
|
use Yoanm\ComposerConfigManager\Application\Request\UpdateConfigurationFileListRequest; |
|
5
|
|
|
use Yoanm\ComposerConfigManager\Application\Updater\ConfigurationFileUpdater; |
|
6
|
|
|
use Yoanm\ComposerConfigManager\Application\Writer\ConfigurationFileWriterInterface; |
|
7
|
|
|
use Yoanm\ComposerConfigManager\Domain\Model\ConfigurationFile; |
|
8
|
|
|
|
|
9
|
|
|
class UpdateConfigurationFileList |
|
10
|
|
|
{ |
|
11
|
|
|
/** @var ConfigurationFileWriterInterface */ |
|
12
|
|
|
private $configurationWriter; |
|
13
|
|
|
/** @var ConfigurationFileUpdater */ |
|
14
|
|
|
private $configurationUpdater; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* @param ConfigurationFileWriterInterface $configurationWriter |
|
18
|
|
|
* @param ConfigurationFileUpdater $configurationUpdater |
|
19
|
|
|
*/ |
|
20
|
1 |
|
public function __construct( |
|
21
|
|
|
ConfigurationFileWriterInterface $configurationWriter, |
|
22
|
|
|
ConfigurationFileUpdater $configurationUpdater |
|
23
|
|
|
) { |
|
24
|
1 |
|
$this->configurationWriter = $configurationWriter; |
|
25
|
1 |
|
$this->configurationUpdater = $configurationUpdater; |
|
26
|
1 |
|
} |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @param UpdateConfigurationFileListRequest $request |
|
30
|
|
|
*/ |
|
31
|
1 |
|
public function run(UpdateConfigurationFileListRequest $request) |
|
32
|
|
|
{ |
|
33
|
1 |
|
$this->configurationWriter->write( |
|
34
|
1 |
|
$this->getConfiguration($request), |
|
35
|
1 |
|
$request->getDestinationFolder() |
|
36
|
1 |
|
); |
|
37
|
1 |
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @param UpdateConfigurationFileListRequest $request |
|
41
|
|
|
* |
|
42
|
|
|
* @return ConfigurationFile |
|
43
|
|
|
*/ |
|
44
|
1 |
|
protected function getConfiguration(UpdateConfigurationFileListRequest $request) |
|
45
|
|
|
{ |
|
46
|
1 |
|
return $this->configurationUpdater->update($request->getConfigurationFileList()); |
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
|