Passed
Push — master ( 3376db...1497f5 )
by Mike
12:25
created

DumperFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 51
ccs 0
cts 27
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A createDumper() 0 15 1
A getCommandList() 0 4 1
A getShellFacade() 0 4 1
A getDockerFacade() 0 4 1
1
<?php
2
3
4
namespace Nexus\Dumper;
5
6
7
use Nexus\Dumper\Business\Dumper;
8
use Xervice\Core\Factory\AbstractFactory;
9
10
/**
11
 * @method \Nexus\Dumper\DumperConfig getConfig()
12
 */
13
class DumperFactory extends AbstractFactory
14
{
15
    /**
16
     * @param string $volume
17
     * @param string $path
18
     * @param string $engine
19
     * @param string $version
20
     *
21
     * @return \Nexus\Dumper\Business\Dumper
22
     * @throws \Xervice\Config\Exception\ConfigNotFound
23
     */
24
    public function createDumper(string $volume, string $path, string $engine, string $version)
25
    {
26
        return new Dumper(
27
            $volume,
28
            $path,
29
            $this->getConfig()->getSshHost(),
30
            $this->getConfig()->getSshUser(),
31
            $engine,
32
            $this->getConfig()->getProject(),
33
            $version,
34
            $this->getConfig()->getImageName(),
35
            $this->getConfig()->getDumpDirectory(),
36
            $this->getDockerFacade()
37
        );
38
    }
39
40
    /**
41
     * @return array
42
     */
43
    public function getCommandList()
44
    {
45
        return $this->getDependency(DumperDependencyProvider::COMMAND_LIST);
46
    }
47
48
    /**
49
     * @return \Nexus\Shell\ShellFacade
50
     */
51
    public function getShellFacade()
52
    {
53
        return $this->getDependency(DumperDependencyProvider::SHELL_FACADE);
54
    }
55
56
    /**
57
     * @return \Nexus\DockerClient\DockerClientFacade
58
     */
59
    public function getDockerFacade()
60
    {
61
        return $this->getDependency(DumperDependencyProvider::DOCKER_FACADE);
62
    }
63
}