1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
namespace Nexus\Dumper\Business; |
5
|
|
|
|
6
|
|
|
use DataProvider\DumperConfigDataProvider; |
7
|
|
|
use Nexus\DockerClient\Business\DockerClientFacadeInterface; |
8
|
|
|
use Nexus\Dumper\Business\Model\Dumper; |
9
|
|
|
use Nexus\Dumper\Business\Model\DumperInterface; |
10
|
|
|
use Nexus\Dumper\DumperDependencyProvider; |
11
|
|
|
use Nexus\Shell\Business\ShellFacadeInterface; |
12
|
|
|
use Xervice\Core\Business\Model\Factory\AbstractBusinessFactory; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @method \Nexus\Dumper\DumperConfig getConfig() |
16
|
|
|
*/ |
17
|
|
|
class DumperBusinessFactory extends AbstractBusinessFactory |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* @param \DataProvider\DumperConfigDataProvider $configDataProvider |
21
|
|
|
* |
22
|
|
|
* @return \Nexus\Dumper\Business\Model\Dumper |
23
|
|
|
*/ |
24
|
|
|
public function createDumper(DumperConfigDataProvider $configDataProvider): DumperInterface |
25
|
|
|
{ |
26
|
|
|
$configDataProvider->setSshHost($this->getConfig()->getSshHost()); |
27
|
|
|
$configDataProvider->setSshUser($this->getConfig()->getSshUser()); |
28
|
|
|
$configDataProvider->setProject($this->getConfig()->getProject()); |
29
|
|
|
$configDataProvider->setImageName($this->getConfig()->getImageName()); |
30
|
|
|
$configDataProvider->setDumpDirectory($this->getConfig()->getDumpDirectory()); |
31
|
|
|
|
32
|
|
|
return new Dumper( |
33
|
|
|
$configDataProvider, |
34
|
|
|
$this->getDockerFacade() |
35
|
|
|
); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @return array |
40
|
|
|
*/ |
41
|
|
|
public function getCommandList(): array |
42
|
|
|
{ |
43
|
|
|
return $this->getDependency(DumperDependencyProvider::COMMAND_LIST); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @return \Nexus\Shell\Business\ShellFacadeInterface |
48
|
|
|
*/ |
49
|
|
|
public function getShellFacade(): ShellFacadeInterface |
50
|
|
|
{ |
51
|
|
|
return $this->getDependency(DumperDependencyProvider::SHELL_FACADE); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @return \Nexus\DockerClient\Business\DockerClientFacadeInterface |
56
|
|
|
*/ |
57
|
|
|
public function getDockerFacade(): DockerClientFacadeInterface |
58
|
|
|
{ |
59
|
|
|
return $this->getDependency(DumperDependencyProvider::DOCKER_FACADE); |
60
|
|
|
} |
61
|
|
|
} |