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

ErrorPageFileExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 16
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateErrorRecordFor() 0 6 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
}