Code Duplication    Length = 15-15 lines in 2 locations

forms/AssetField.php 1 location

@@ 758-772 (lines=15) @@
755
	 * @param $default Default value to return if no value could be calculated
756
	 * @return string Foreign class name.
757
	 */
758
	public function getRelationAutosetClass($default = 'File') {
759
760
		// Don't autodetermine relation if no relationship between parent record
761
		if(!$this->relationAutoSetting) return $default;
762
763
		// Check record and name
764
		$name = $this->getName();
765
		$record = $this->getRecord();
766
		if(empty($name) || empty($record)) {
767
			return $default;
768
		} else {
769
			$class = $record->getRelationClass($name);
770
			return empty($class) ? $default : $class;
771
		}
772
	}
773
774
	/**
775
	 * @return AssetStore

forms/UploadField.php 1 location

@@ 1331-1345 (lines=15) @@
1328
	 * @param $default Default value to return if no value could be calculated
1329
	 * @return string Foreign class name.
1330
	 */
1331
	public function getRelationAutosetClass($default = 'File') {
1332
1333
		// Don't autodetermine relation if no relationship between parent record
1334
		if(!$this->relationAutoSetting) return $default;
1335
1336
		// Check record and name
1337
		$name = $this->getName();
1338
		$record = $this->getRecord();
1339
		if(empty($name) || empty($record)) {
1340
			return $default;
1341
		} else {
1342
			$class = $record->getRelationClass($name);
1343
			return empty($class) ? $default : $class;
1344
		}
1345
	}
1346
1347
}
1348