Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\Core\ParamConverter;
|
Chris@0
|
4
|
Chris@0
|
5 /**
|
Chris@0
|
6 * Provides an exception class for a request parameter that was not converted.
|
Chris@0
|
7 */
|
Chris@0
|
8 class ParamNotConvertedException extends \Exception {
|
Chris@0
|
9
|
Chris@0
|
10 /**
|
Chris@0
|
11 * The route name that was not converted.
|
Chris@0
|
12 *
|
Chris@0
|
13 * @var string
|
Chris@0
|
14 */
|
Chris@0
|
15 protected $routeName = "";
|
Chris@0
|
16
|
Chris@0
|
17 /**
|
Chris@0
|
18 * The raw parameters that were not converted.
|
Chris@0
|
19 *
|
Chris@0
|
20 * @var array
|
Chris@0
|
21 */
|
Chris@0
|
22 protected $rawParameters = [];
|
Chris@0
|
23
|
Chris@0
|
24 /**
|
Chris@0
|
25 * Constructs the ParamNotConvertedException.
|
Chris@0
|
26 *
|
Chris@0
|
27 * @param string $message
|
Chris@0
|
28 * The Exception message to throw.
|
Chris@0
|
29 * @param int $code
|
Chris@0
|
30 * The Exception code.
|
Chris@0
|
31 * @param \Exception $previous
|
Chris@0
|
32 * The previous exception used for the exception chaining.
|
Chris@0
|
33 * @param string $route_name
|
Chris@0
|
34 * The route name that was not converted.
|
Chris@0
|
35 * @param array $raw_parameters
|
Chris@0
|
36 * The raw parameters that were not converted.
|
Chris@0
|
37 */
|
Chris@0
|
38 public function __construct($message = "", $code = 0, \Exception $previous = NULL, $route_name = "", array $raw_parameters = []) {
|
Chris@0
|
39 parent::__construct($message, $code, $previous);
|
Chris@0
|
40 $this->routeName = $route_name;
|
Chris@0
|
41 $this->rawParameters = $raw_parameters;
|
Chris@0
|
42 }
|
Chris@0
|
43
|
Chris@0
|
44 /**
|
Chris@0
|
45 * Get the route name that was not converted.
|
Chris@0
|
46 *
|
Chris@0
|
47 * @return string
|
Chris@0
|
48 * The route name that was not converted.
|
Chris@0
|
49 */
|
Chris@0
|
50 public function getRouteName() {
|
Chris@0
|
51 return $this->routeName;
|
Chris@0
|
52 }
|
Chris@0
|
53
|
Chris@0
|
54 /**
|
Chris@0
|
55 * Get the raw parameters that were not converted.
|
Chris@0
|
56 *
|
Chris@0
|
57 * @return array
|
Chris@0
|
58 * The raw parameters that were not converted.
|
Chris@0
|
59 */
|
Chris@0
|
60 public function getRawParameters() {
|
Chris@0
|
61 return $this->rawParameters;
|
Chris@0
|
62 }
|
Chris@0
|
63
|
Chris@0
|
64 }
|