Completed
Push — master ( c7b947...966759 )
by Thomas
08:09
created

OneToManyRelationship   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 24
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
A getRelatedName() 0 8 2
A getReverseRelatedName() 0 8 2
1
<?php
2
namespace keeko\tools\model;
3
4
class OneToManyRelationship extends OneToOneRelationship {
5
6
	public function getType() {
7
		return self::ONE_TO_MANY;
8
	}
9
10
	public function getRelatedName() {
11
		$relatedName = $this->fk->getRefPhpName();
12
		if (empty($relatedName)) {
13
			$relatedName = $this->foreign->getPhpName();
14
		}
15
16
		return $relatedName;
17
	}
18
	
19
	public function getReverseRelatedName() {
20
		$reverseRelatedName = $this->fk->getPhpName();
21
		if (empty($reverseRelatedName)) {
22
			$reverseRelatedName = $this->model->getPhpName();
23
		}
24
		
25
		return $reverseRelatedName;
26
	}
27
}