Passed
Push — master ( f5da16...2e3bf1 )
by Jean-Christophe
12:28
created

DatabaseMetadatas::getForeignKeys()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 2
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
namespace Ubiquity\db\traits;
4
5
use Ubiquity\db\utils\DbTypes;
6
7
/**
8
 * Retreives metadatas from the database.
9
 *
10
 * Ubiquity\db\traits$DatabaseMetadatas
11
 * This class is part of Ubiquity
12
 *
13
 * @author jcheron <[email protected]>
14
 * @version 1.0.4
15
 *
16
 * @property \Ubiquity\db\providers\AbstractDbWrapper $wrapperObject
17
 */
18
trait DatabaseMetadatas {
19
20 4
	public function getTablesName() {
21 4
		return $this->wrapperObject->getTablesName ();
22
	}
23
24 1
	public function getPrimaryKeys($tableName) {
25 1
		return $this->wrapperObject->getPrimaryKeys ( $tableName );
26
	}
27
28 1
	public function getFieldsInfos($tableName) {
29 1
		return $this->wrapperObject->getFieldsInfos ( $tableName );
30
	}
31
32 1
	public function getForeignKeys($tableName, $pkName, $dbName = null) {
33 1
		return $this->wrapperObject->getForeignKeys ( $tableName, $pkName, $dbName );
34
	}
35
36 4
	public function getRowNum(string $tableName, string $pkName, string $condition): int {
37 4
		return $this->wrapperObject->getRowNum ( $tableName, $pkName, $condition );
38
	}
39
40
	public function getPHPType(string $dbType): string {
41
		return DbTypes::asPhpType($dbType);
42
	}
43
	
44
	/**
45
	 * Returns the SQL command for a migration operation. 
46
	 * @param string $operation The migration to opere
47
	 * @return string The generated SQL string
48
	 */
49
	public function migrateOperation(string $operation):string {
50
		return $this->wrapperObject->migrateOperation($operation);
51
	}
52
}
53
54