aboutsummaryrefslogtreecommitdiff
path: root/lib/Minz/Mailer.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Minz/Mailer.php')
-rw-r--r--lib/Minz/Mailer.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Minz/Mailer.php b/lib/Minz/Mailer.php
index bd5e97ceb..86c5c33da 100644
--- a/lib/Minz/Mailer.php
+++ b/lib/Minz/Mailer.php
@@ -39,10 +39,18 @@ class Minz_Mailer {
private int $debug_level;
/**
- * Constructor.
+ * @phpstan-param class-string|'' $viewType
+ * @param string $viewType Name of the class (inheriting from Minz_View) to use for the view model
*/
- public function __construct () {
- $this->view = new Minz_View();
+ public function __construct(string $viewType = '') {
+ $view = null;
+ if ($viewType !== '' && class_exists($viewType)) {
+ $view = new $viewType();
+ if (!($view instanceof Minz_View)) {
+ $view = null;
+ }
+ }
+ $this->view = $view ?? new Minz_View();
$this->view->_layout(null);
$this->view->attributeParams();