Completed
Pull Request — master (#1381)
by Damian
07:50
created

ErrorPageFileExtension::updateErrorRecordFor()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 6
rs 9.4285
cc 2
eloc 4
nc 2
nop 2
1
<?php
2
3
/**
4
 * Decorates {@see File} with ErrorPage support
5
 */
6
class ErrorPageFileExtension extends DataExtension {
7
8
	/**
9
	 * Used by {@see File::getErrorRecordFor}
10
	 *
11
	 * @param DataObject $record
12
	 * @param int $statusCode
13
	 */
14
	public function updateErrorRecordFor(&$record, $statusCode) {
15
		$errorPage = ErrorPage::get()->filter("ErrorCode", $statusCode)->first();
16
		if($errorPage) {
17
			$record = $errorPage;
18
		}
19
	}
20
21
}