Completed
Pull Request — master (#1399)
by Ingo
02:43
created

ErrorPageFileExtension::getErrorRecordFor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/**
4
 * Decorates {@see File} with ErrorPage support
5
 */
6
class ErrorPageFileExtension extends DataExtension {
7
8
	/**
9
	 * Used by {@see File::handle_shortcode}
10
	 *
11
	 * @param int $statusCode HTTP Error code
12
	 * @return DataObject Substitute object suitable for handling the given error code
13
	 */
14
	public function getErrorRecordFor($statusCode) {
15
		return ErrorPage::get()->filter("ErrorCode", $statusCode)->first();
16
	}
17
18
}
19