File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -61,16 +61,21 @@ public function getLayout(): string
6161 /**
6262 * @param string $layout
6363 */
64+
65+ /**
66+ * @param string $layout
67+ *
68+ * @return void
69+ *
70+ * @throws PhpTemplateNotFoundException
71+ */
6472 public function setLayout (string $ layout ): void
6573 {
66- if ($ layout === '' || $ layout === null ) {
67- $ this ->layout = null ;
68- } else {
69- if (!$ this ->templateExists ($ layout )) {
70- throw new PhpTemplateNotFoundException ('Layout template " ' . $ layout . '" does not exist ' );
71- }
72- $ this ->layout = $ layout ;
74+ if ($ layout && !$ this ->templateExists ($ layout )) {
75+ throw new PhpTemplateNotFoundException ('Layout template " ' . $ layout . '" does not exist ' );
7376 }
77+
78+ $ this ->layout = $ layout ;
7479 }
7580
7681 /**
@@ -144,7 +149,7 @@ public function setTemplatePath(string $templatePath): void
144149 public function fetch (string $ template , array $ data = [], bool $ useLayout = false ): string
145150 {
146151 $ output = $ this ->fetchTemplate ($ template , $ data );
147- if ($ this ->layout !== null && $ useLayout ) {
152+ if ($ this ->layout && $ useLayout ) {
148153 $ data ['content ' ] = $ output ;
149154 $ output = $ this ->fetchTemplate ($ this ->layout , $ data );
150155 }
You can’t perform that action at this time.
0 commit comments