Code Duplication    Length = 17-17 lines in 2 locations

model/DataObject.php 2 locations

@@ 1876-1892 (lines=17) @@
1873
	 *        the field data stripped off. It defaults to TRUE.
1874
	 * @return string|array
1875
	 */
1876
	public function belongsTo($component = null, $classOnly = true) {
1877
		if($component) {
1878
			Deprecation::notice(
1879
				'4.0',
1880
				'Please use DataObject::belongsToComponent() instead of passing a component name to belongsTo()',
1881
				Deprecation::SCOPE_GLOBAL
1882
			);
1883
			return $this->belongsToComponent($component, $classOnly);
1884
		}
1885
1886
		$belongsTo = (array)Config::inst()->get($this->class, 'belongs_to', Config::INHERITED);
1887
		if($belongsTo && $classOnly) {
1888
			return preg_replace('/(.+)?\..+/', '$1', $belongsTo);
1889
		} else {
1890
			return $belongsTo ? $belongsTo : array();
1891
		}
1892
	}
1893
1894
	/**
1895
	 * Return data for a specific belongs_to component.
@@ 1974-1990 (lines=17) @@
1971
	 *        the field data stripped off. It defaults to TRUE.
1972
	 * @return string|array|false
1973
	 */
1974
	public function hasMany($component = null, $classOnly = true) {
1975
		if($component) {
1976
			Deprecation::notice(
1977
				'4.0',
1978
				'Please use DataObject::hasManyComponent() instead of passing a component name to hasMany()',
1979
				Deprecation::SCOPE_GLOBAL
1980
			);
1981
			return $this->hasManyComponent($component, $classOnly);
1982
		}
1983
1984
		$hasMany = (array)Config::inst()->get($this->class, 'has_many', Config::INHERITED);
1985
		if($hasMany && $classOnly) {
1986
			return preg_replace('/(.+)?\..+/', '$1', $hasMany);
1987
		} else {
1988
			return $hasMany ? $hasMany : array();
1989
		}
1990
	}
1991
1992
	/**
1993
	 * Return data for a specific has_many component.