Code Duplication    Length = 17-17 lines in 2 locations

model/DataObject.php 2 locations

@@ 1968-1984 (lines=17) @@
1965
	 *        the field data stripped off. It defaults to TRUE.
1966
	 * @return string|array
1967
	 */
1968
	public function belongsTo($component = null, $classOnly = true) {
1969
		if($component) {
1970
			Deprecation::notice(
1971
				'4.0',
1972
				'Please use DataObject::belongsToComponent() instead of passing a component name to belongsTo()',
1973
				Deprecation::SCOPE_GLOBAL
1974
			);
1975
			return $this->belongsToComponent($component, $classOnly);
1976
		}
1977
1978
		$belongsTo = (array)Config::inst()->get($this->class, 'belongs_to', Config::INHERITED);
1979
		if($belongsTo && $classOnly) {
1980
			return preg_replace('/(.+)?\..+/', '$1', $belongsTo);
1981
		} else {
1982
			return $belongsTo ? $belongsTo : array();
1983
		}
1984
	}
1985
1986
	/**
1987
	 * Return data for a specific belongs_to component.
@@ 2063-2079 (lines=17) @@
2060
	 *        the field data stripped off. It defaults to TRUE.
2061
	 * @return string|array|false
2062
	 */
2063
	public function hasMany($component = null, $classOnly = true) {
2064
		if($component) {
2065
			Deprecation::notice(
2066
				'4.0',
2067
				'Please use DataObject::hasManyComponent() instead of passing a component name to hasMany()',
2068
				Deprecation::SCOPE_GLOBAL
2069
			);
2070
			return $this->hasManyComponent($component, $classOnly);
2071
		}
2072
2073
		$hasMany = (array)Config::inst()->get($this->class, 'has_many', Config::INHERITED);
2074
		if($hasMany && $classOnly) {
2075
			return preg_replace('/(.+)?\..+/', '$1', $hasMany);
2076
		} else {
2077
			return $hasMany ? $hasMany : array();
2078
		}
2079
	}
2080
2081
	/**
2082
	 * Return data for a specific has_many component.