Test Failed
Pull Request — master (#59)
by
unknown
14:18
created

YumlModelsCreator::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 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 2
ccs 2
cts 2
cp 1
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
namespace Ubiquity\orm\creator\yuml;
3
4
use Ubiquity\orm\creator\ModelsCreator;
5
6
7
class YumlModelsCreator extends ModelsCreator{
8
	/**
9
	 * @var YumlParser
10
	 */
11
	private $yumlParser;
12
13 1
	protected function init($config){
14 1
		parent::init($config);
15 1
	}
16
17 1
	public function initYuml($yumlString) {
18 1
		$this->yumlParser=new YumlParser($yumlString);
19 1
	}
20
21
22 1
	protected function getTablesName(){
23 1
		return $this->yumlParser->getTableNames();
24
	}
25
26 1
	protected function getFieldsInfos($tableName) {
27 1
		$fieldsInfos=array();
28 1
		$fields = $this->yumlParser->getFields($tableName);
29 1
		foreach ($fields as $field) {
30 1
			$fieldsInfos[$field['name']] = ["Type"=>$field['type'],"Nullable"=>(isset($field["null"]) && $field["null"])];
31
		}
32 1
		return $fieldsInfos;
33
	}
34
35 1
	protected function getPrimaryKeys($tableName){
36 1
		return $this->yumlParser->getPrimaryKeys($tableName);
37
	}
38
39 1
	protected function getForeignKeys($tableName,$pkName){
40 1
		return $this->yumlParser->getForeignKeys($tableName);
41
	}
42
}
43