CommandFactory   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 27
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 3 1
A createPgPhp() 0 3 1
A __construct() 0 3 1
A createPsql() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace PmgDev\DatabaseReplicator\Database\Postgres;
4
5
use PmgDev\DatabaseReplicator;
6
7
class CommandFactory
8
{
9
	/** @var string */
10
	private $psql;
11
12
13
	public function __construct(string $psql = '/usr/bin/psql')
14
	{
15
		$this->psql = $psql;
16
	}
17
18
19
	public function create(DatabaseReplicator\Config $config): DatabaseReplicator\Command
20
	{
21
		return new Command($this->createPgPhp($config), $this->createPsql($config));
22
	}
23
24
25
	private function createPgPhp(DatabaseReplicator\Config $config): PgPhp
26
	{
27
		return new PgPhp($config);
28
	}
29
30
31
	private function createPsql(DatabaseReplicator\Config $config): Psql
32
	{
33
		return new Psql($config, $this->psql);
34
	}
35
36
}
37