1 | <?php |
||
29 | class ExceptionStrategy extends AbstractListenerAggregate |
||
30 | { |
||
31 | /** |
||
32 | * Display exceptions? |
||
33 | * @var bool |
||
34 | */ |
||
35 | protected $displayExceptions = false; |
||
36 | |||
37 | /** |
||
38 | * Default Exception Message |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $defaultExceptionMessage = 'Oh no. Something went wrong, but we have been notified. If you are testing, tell us your eventID: %s'; |
||
42 | |||
43 | /** |
||
44 | * Name of exception template |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $exceptionTemplate = 'error'; |
||
48 | |||
49 | /** |
||
50 | * {@inheritDoc} |
||
51 | */ |
||
52 | public function attach(EventManagerInterface $events, $priority = 1) |
||
57 | |||
58 | /** |
||
59 | * Flag: display exceptions in error pages? |
||
60 | * |
||
61 | * @param bool $displayExceptions |
||
62 | * @return ExceptionStrategy |
||
63 | */ |
||
64 | public function setDisplayExceptions($displayExceptions): ExceptionStrategy |
||
69 | |||
70 | /** |
||
71 | * Should we display exceptions in error pages? |
||
72 | * |
||
73 | * @return bool |
||
74 | */ |
||
75 | public function displayExceptions(): bool |
||
79 | |||
80 | /** |
||
81 | * Set the default exception message |
||
82 | * @param string $defaultExceptionMessage |
||
83 | * @return self |
||
84 | */ |
||
85 | public function setDefaultExceptionMessage($defaultExceptionMessage): self |
||
90 | |||
91 | /** |
||
92 | * Set the exception template |
||
93 | * |
||
94 | * @param string $exceptionTemplate |
||
95 | * @return ExceptionStrategy |
||
96 | */ |
||
97 | public function setExceptionTemplate($exceptionTemplate): ExceptionStrategy |
||
102 | |||
103 | /** |
||
104 | * Retrieve the exception template |
||
105 | * |
||
106 | * @return string |
||
107 | */ |
||
108 | public function getExceptionTemplate(): string |
||
112 | |||
113 | /** |
||
114 | * Create an exception view model, and set the HTTP status code |
||
115 | * |
||
116 | * @param MvcEvent $e |
||
117 | * @return void |
||
118 | */ |
||
119 | public function prepareExceptionViewModel(MvcEvent $e): void |
||
178 | } |