Command   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 49
rs 10
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 3 1
A existsDatabase() 0 3 1
A drop() 0 3 1
A __construct() 0 4 1
A listDatabases() 0 3 1
A copy() 0 3 1
A commandImport() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace PmgDev\DatabaseReplicator\Database\Postgres;
4
5
use PmgDev\DatabaseReplicator;
6
use PmgDev\DatabaseReplicator\Config;
7
use PmgDev\DatabaseReplicator\Source;
8
9
class Command extends DatabaseReplicator\Database\Command
10
{
11
	/** @var PgPhp */
12
	private $pgPhp;
13
14
	/** @var Psql */
15
	private $psql;
16
17
18
	public function __construct(PgPhp $pgPhp, Psql $psql)
19
	{
20
		$this->pgPhp = $pgPhp;
21
		$this->psql = $psql;
22
	}
23
24
25
	public function drop(string $database): void
26
	{
27
		$this->pgPhp->drop($database);
28
	}
29
30
31
	public function copy(Config $source, string $cloneDb): void
32
	{
33
		$this->pgPhp->copy($source, $cloneDb);
34
	}
35
36
37
	public function existsDatabase(string $database): bool
38
	{
39
		return $this->pgPhp->existsDatabase($database);
40
	}
41
42
43
	public function listDatabases(): iterable
44
	{
45
		return $this->pgPhp->listDatabases();
46
	}
47
48
49
	public function create(Config $config): void
50
	{
51
		$this->pgPhp->create($config);
52
	}
53
54
55
	protected function commandImport(Source\Files $filenames, Config $config): void
56
	{
57
		$this->psql->importFiles($filenames, $config);
58
	}
59
60
}
61