Code Duplication    Length = 17-17 lines in 2 locations

model/DataObject.php 2 locations

@@ 1982-1998 (lines=17) @@
1979
	 *        the field data stripped off. It defaults to TRUE.
1980
	 * @return string|array
1981
	 */
1982
	public function belongsTo($component = null, $classOnly = true) {
1983
		if($component) {
1984
			Deprecation::notice(
1985
				'4.0',
1986
				'Please use DataObject::belongsToComponent() instead of passing a component name to belongsTo()',
1987
				Deprecation::SCOPE_GLOBAL
1988
			);
1989
			return $this->belongsToComponent($component, $classOnly);
1990
		}
1991
1992
		$belongsTo = (array)Config::inst()->get($this->class, 'belongs_to', Config::INHERITED);
1993
		if($belongsTo && $classOnly) {
1994
			return preg_replace('/(.+)?\..+/', '$1', $belongsTo);
1995
		} else {
1996
			return $belongsTo ? $belongsTo : array();
1997
		}
1998
	}
1999
2000
	/**
2001
	 * Return data for a specific belongs_to component.
@@ 2077-2093 (lines=17) @@
2074
	 *        the field data stripped off. It defaults to TRUE.
2075
	 * @return string|array|false
2076
	 */
2077
	public function hasMany($component = null, $classOnly = true) {
2078
		if($component) {
2079
			Deprecation::notice(
2080
				'4.0',
2081
				'Please use DataObject::hasManyComponent() instead of passing a component name to hasMany()',
2082
				Deprecation::SCOPE_GLOBAL
2083
			);
2084
			return $this->hasManyComponent($component, $classOnly);
2085
		}
2086
2087
		$hasMany = (array)Config::inst()->get($this->class, 'has_many', Config::INHERITED);
2088
		if($hasMany && $classOnly) {
2089
			return preg_replace('/(.+)?\..+/', '$1', $hasMany);
2090
		} else {
2091
			return $hasMany ? $hasMany : array();
2092
		}
2093
	}
2094
2095
	/**
2096
	 * Return data for a specific has_many component.