InstallerException.php 1009 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace Drupal\Core\Installer\Exception;
  3. use Drupal\Core\StringTranslation\StringTranslationTrait;
  4. /**
  5. * Base class for exceptions thrown by installer.
  6. */
  7. class InstallerException extends \RuntimeException {
  8. use StringTranslationTrait;
  9. /**
  10. * The page title to output.
  11. *
  12. * @var string
  13. */
  14. protected $title;
  15. /**
  16. * Constructs a new installer exception.
  17. *
  18. * @param string $message
  19. * The exception message.
  20. * @param string $title
  21. * (optional) The page title. Defaults to 'Error'.
  22. * @param int $code
  23. * (optional) The exception code. Defaults to 0.
  24. * @param \Exception $previous
  25. * (optional) A previous exception.
  26. */
  27. public function __construct($message, $title = 'Error', $code = 0, \Exception $previous = NULL) {
  28. parent::__construct($message, $code, $previous);
  29. $this->title = $title;
  30. }
  31. /**
  32. * Returns the exception page title.
  33. *
  34. * @return string
  35. */
  36. public function getTitle() {
  37. return $this->title;
  38. }
  39. }