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

YumlModelsCreator   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 8
eloc 12
dl 0
loc 34
ccs 18
cts 18
cp 1
rs 10
c 2
b 1
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A initYuml() 0 2 1
A getFieldsInfos() 0 7 3
A getTablesName() 0 2 1
A init() 0 2 1
A getPrimaryKeys() 0 2 1
A getForeignKeys() 0 2 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