Code Duplication    Length = 11-11 lines in 2 locations

model/DataObject.php 2 locations

@@ 1993-2003 (lines=11) @@
1990
	 *        the field data stripped off. It defaults to TRUE.
1991
	 * @return string|null
1992
	 */
1993
	public function belongsToComponent($component, $classOnly = true) {
1994
		$belongsTo = (array)Config::inst()->get($this->class, 'belongs_to', Config::INHERITED);
1995
1996
		if($belongsTo && array_key_exists($component, $belongsTo)) {
1997
			$belongsTo = $belongsTo[$component];
1998
		} else {
1999
			return null;
2000
		}
2001
2002
		return ($classOnly) ? preg_replace('/(.+)?\..+/', '$1', $belongsTo) : $belongsTo;
2003
	}
2004
2005
	/**
2006
	 * Return all of the database fields in this object
@@ 2088-2098 (lines=11) @@
2085
	 *        the field data stripped off. It defaults to TRUE.
2086
	 * @return string|null
2087
	 */
2088
	public function hasManyComponent($component, $classOnly = true) {
2089
		$hasMany = (array)Config::inst()->get($this->class, 'has_many', Config::INHERITED);
2090
2091
		if($hasMany && array_key_exists($component, $hasMany)) {
2092
			$hasMany = $hasMany[$component];
2093
		} else {
2094
			return null;
2095
		}
2096
2097
		return ($classOnly) ? preg_replace('/(.+)?\..+/', '$1', $hasMany) : $hasMany;
2098
	}
2099
2100
	/**
2101
	 * Return the many-to-many extra fields specification.