ParamNotConvertedException.php 1.5 KB

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