CommandFactory::createPsql()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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