Code Duplication    Length = 7-9 lines in 3 locations

src/Darya/ORM/Relation/BelongsTo.php 1 location

@@ 17-23 (lines=7) @@
14
	/**
15
	 * Set the default keys for the relation if they have not yet been set.
16
	 */
17
	protected function setDefaultKeys() {
18
		if (!$this->foreignKey) {
19
			$this->foreignKey = $this->prepareForeignKey(get_class($this->target));
20
		}
21
		
22
		$this->localKey = $this->target->key();
23
	}
24
	
25
	/**
26
	 * Retrieve the default filter for this relation.

src/Darya/ORM/Relation/Has.php 1 location

@@ 18-24 (lines=7) @@
15
	/**
16
	 * Set the default keys for the relation if they have not yet been set.
17
	 */
18
	protected function setDefaultKeys() {
19
		if (!$this->foreignKey) {
20
			$this->foreignKey = $this->prepareForeignKey(get_class($this->parent));
21
		}
22
		
23
		$this->localKey = $this->parent->key();
24
	}
25
	
26
	/**
27
	 * Eagerly load the related models for the given parent instances.

src/Darya/ORM/Relation/BelongsToMany.php 1 location

@@ 115-123 (lines=9) @@
112
	/**
113
	 * Set the default keys for the relation if they have not already been set.
114
	 */
115
	protected function setDefaultKeys() {
116
		if (!$this->foreignKey) {
117
			$this->foreignKey = $this->prepareForeignKey(get_class($this->target));
118
		}
119
		
120
		if (!$this->localKey) {
121
			$this->localKey = $this->prepareForeignKey(get_class($this->parent));
122
		}
123
	}
124
	
125
	/**
126
	 * Set the default many-to-many relation table name.