File: NotFound.php

package info (click to toggle)
simplesamlphp 1.13.1-2%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 11,304 kB
  • sloc: php: 65,124; xml: 629; python: 376; sh: 193; perl: 185; makefile: 43
file content (52 lines) | stat: -rw-r--r-- 1,148 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php

/**
 * Exception which will show a 404 Not Found error page.
 *
 * This exception can be thrown from within an module page handler. The user will then be
 * shown a 404 Not Found error page.
 *
 * @author Olav Morken, UNINETT AS.
 * @package simpleSAMLphp
 */
class SimpleSAML_Error_NotFound extends SimpleSAML_Error_Error {


	/**
	 * Reason why the given page could not be found.
	 */
	private $reason;


	/**
	 * Create a new NotFound error
	 *
	 * @param string $reason  Optional description of why the given page could not be found.
	 */
	public function __construct($reason = NULL) {

		assert('is_null($reason) || is_string($reason)');

		$url = SimpleSAML_Utilities::selfURL();

		if($reason === NULL) {
			parent::__construct(array('NOTFOUND', '%URL%' => $url));
		} else {
			parent::__construct(array('NOTFOUNDREASON', '%URL%' => $url, '%REASON%' => $reason));
		}

		$this->reason = $reason;
		$this->httpCode = 404;
	}


	/**
	 * Retrieve the reason why the given page could not be found.
	 *
	 * @return string|NULL  The reason why the page could not be found.
	 */
	public function getReason() {
		return $this->reason;
	}

}